<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">I agree. I was going to write pretty much this exact email, but you beat me to it.<div>I was implementing some user-configurable colour customizations in an application and needed to do it with style sheets, along with something that reads colours along the lines of what the new platform preferences API does. </div><div>I make a base64 data URL from a dynamically generated style sheet to avoid writing temp CSS files to style the app. </div><div>I also needed to do this to work around the style sheet having higher priority than programmatically set colours as per my misunderstanding in <a href="https://bugs.openjdk.org/browse/JDK-8317434">https://bugs.openjdk.org/browse/JDK-8317434</a></div><div>So I see value in having Color implement something like this.<br><div><br id="lineBreakAtBeginningOfSignature"><div dir="ltr">Scott</div><div dir="ltr"><br><blockquote type="cite">On Dec 11, 2023, at 4:19 PM, Eran Leshem <eran@leshem.life> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><span>Thank you for your responses.</span><br><span></span><br><span>Given that the framework requires colors in string format in its style APIs, I think it should provide some way to convert colors to strings as expected by these APIs. Otherwise, clients are forced to implement this bridging logic on their own, due to a framework gap.</span><br><span></span><br><span>And given that Color already parses these string representations, I think it makes sense for it to provide the inverse conversion.</span><br><span></span><br><span>Eran</span><br><span></span><br><span>-----Original Message-----</span><br><span>From: openjfx-dev [mailto:openjfx-dev-retn@openjdk.org] On Behalf Of John Hendrikx</span><br><span>Sent: Saturday, December 09, 2023 11:35 PM</span><br><span>To: openjfx-dev@openjdk.org</span><br><span>Subject: Re: Converting a Color object to its string representation</span><br><span></span><br><span>I think this is too niche to have Color provide.</span><br><span></span><br><span>Just make a utility method for whatever format you desire, instead of </span><br><span>making Color responsible for half a dozen ways of formatting colors, and </span><br><span>then probably still missing some format that someone needs.</span><br><span></span><br><span>Ticket should be closed as won't fix.</span><br><span></span><br><span>--John</span><br><span></span><br><span>On 09/12/2023 22:06, Michael Strauß wrote:</span><br><blockquote type="cite"><span>I obviously meant to write withPrefix("#"), not withDelimiter("#")...</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>On Sat, Dec 9, 2023 at 9:57 PM Michael Strauß <michaelstrau2@gmail.com> wrote:</span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span>How would HexFormat work with Color, other than using an extremely</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>unwieldy syntax?</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span> String formatted = HexFormat.of()</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span> .withDelimiter("#")</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span> .formatHex(new byte[] {</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span> (byte)(color.getRed() * 255.0f),</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span> (byte)(color.getGreen() * 255.0f),</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span> (byte)(color.getBlue() * 255.0f),</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span> (byte)(color.getOpacity() * 255.0f)</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span> });</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>On Sat, Dec 9, 2023 at 9:40 PM David Alayachew <davidalayachew@gmail.com> wrote:</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>Apologies - java.util.HexFormat</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>That's what I get for firing from the hip, then looking afterwards.</span><br></blockquote></blockquote></blockquote><span></span><br></div></blockquote></div></div></body></html>