Hi,
if I use the new colorfield in Kirby and output the colorvalue with ->escape('css')
as proposed. But css can not read the color value.
The output is \#0aa1e2;
.
Should I ignore the escaping?
Why is there a special css escaping if it doesn’t work in css?
Best
Could you please post your code how you use it?
To better see if it’s something in the usage, on our part of the code or an issue in the library used (GitHub - laminas/laminas-escaper: Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs).
Hi,
Iwrite this in the site header to define the primary template colors:
<style>
:root{
--primary: <?= $site->primarycolor()->escape('css') ?>;
--secondary: <?= $site->secondarycolor()->escape('css') ?>;
}
</style>
this will output in
<style>
:root{
--primary: \23 c6d72f;
--secondary: \23 0aa1e2;
}
</style>
what a little bit strange is, is that output before was a little bit different (#0aa1e2) . Both in Firefox but the escape problem exis talso in Chrome and Safari.
Could be the space after the escape a problem?
@distantnative have you any clue whats wrong? I run also in the last versions of kirby in these problem.
@JanStieler Sorry that I didn’t’t get earlier to looking at this. I can reproduce it and it seems to be a bug in the underlying Laminas Escaper library. I have submitted a bug report to them: HEX colors broken after using escapeCSS · Issue #66 · laminas/laminas-escaper · GitHub
No problem. But I run again in this and that’s why I get up this thread. Thanks for posting the bug report. Hopefully they find a solution.
Best