<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
Or the third option:<br>
<br>
3. Do nothing<br>
<br>
I would go for option 1 or 3. I do not recommend option 2.<br>
<br>
I see some value in a minimal API (option 1), returning a fixed
format, perhaps:<br>
<br>
if alpha == 1 { "#rrggbb" } else { "#rrggbbaa" }<br>
<br>
-- Kevin<br>
<br>
<br>
<div class="moz-cite-prefix">On 12/12/2023 4:04 PM, Eran Leshem
wrote:<br>
</div>
<blockquote type="cite" cite="mid:006501da2d57$fd6350c0$f829f240$@leshem.life">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style>@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}@font-face
{font-family:"Freestyle Script";
panose-1:3 8 4 2 3 2 5 11 4 4;}@font-face
{font-family:"Iosevka Fixed SS16";}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Calibri","sans-serif";}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Calibri","sans-serif";}span.EmailStyle17
{mso-style-type:personal;
font-family:"Iosevka Fixed SS16";
color:windowtext;}span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}div.WordSection1
{page:WordSection1;}ol
{margin-bottom:0cm;}ul
{margin-bottom:0cm;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">I can see two
options:<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><!--[if !supportLists]--><span style="font-size:11.0pt;color:#1F497D"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman""> </span></span></span><!--[endif]--><span dir="LTR"></span><span style="font-size:11.0pt;color:#1F497D">Minimal, just in
order to satisfy the style APIs need – supporting a single
format. I would go with non-% rgba, since it covers all
dimensions in the most straightforward way.<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><!--[if !supportLists]--><span style="font-size:11.0pt;color:#1F497D"><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman""> </span></span></span><!--[endif]--><span dir="LTR"></span><span style="font-size:11.0pt;color:#1F497D">Complete – supporting
all formats accepted by Color.web(), either via multiple
methods or via an enum parameter<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Freestyle Script";color:#1F497D">Eran<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-family:"Tahoma","sans-serif"">
openjfx-dev [<a class="moz-txt-link-freetext" href="mailto:openjfx-dev-retn@openjdk.org">mailto:openjfx-dev-retn@openjdk.org</a>] <b>On
Behalf Of </b>Andy Goryachev<br>
<b>Sent:</b> Tuesday, December 12, 2023 6:08 PM<br>
<b>To:</b> Scott Palmer; <a class="moz-txt-link-abbreviated" href="mailto:openjfx-dev@openjdk.org">openjfx-dev@openjdk.org</a><br>
<b>Subject:</b> Re: Converting a Color object to its
string representation<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">I
also think that the platform will benefit from adding this
symmetrical API. <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">It
is less clear how that new API should deal with all the
multiple variants of the web format (#rgb, #rrggbb, rgb,
rgba, 0x*, ...).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">openjfx-dev
<a class="moz-txt-link-rfc2396E" href="mailto:openjfx-dev-retn@openjdk.org"><openjfx-dev-retn@openjdk.org></a> on behalf of
Scott Palmer <a class="moz-txt-link-rfc2396E" href="mailto:swpalmer@gmail.com"><swpalmer@gmail.com></a><br>
<b>Date: </b>Monday, December 11, 2023 at 17:12<br>
<b>To: </b><a class="moz-txt-link-abbreviated" href="mailto:openjfx-dev@openjdk.org">openjfx-dev@openjdk.org</a>
<a class="moz-txt-link-rfc2396E" href="mailto:openjfx-dev@openjdk.org"><openjfx-dev@openjdk.org></a><br>
<b>Subject: </b>Re: Converting a Color object to its
string representation<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt">I agree.
I was going to write pretty much this exact email, but
you beat me to it.<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">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. <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">I make
a base64 data URL from a dynamically generated style
sheet to avoid writing temp CSS files to style the
app. <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">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" moz-do-not-send="true" class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/JDK-8317434</a><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">So I
see value in having Color implement something like
this.<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Scott<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt">On Dec 11, 2023, at
4:19 PM, Eran Leshem <a class="moz-txt-link-rfc2396E" href="mailto:eran@leshem.life"><eran@leshem.life></a>
wrote:<o:p></o:p></span></p>
</blockquote>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt">Thank you for your
responses.<br>
<br>
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.<br>
<br>
And given that Color already parses these string
representations, I think it makes sense for it
to provide the inverse conversion.<br>
<br>
Eran<br>
<br>
-----Original Message-----<br>
From: openjfx-dev
[<a class="moz-txt-link-freetext" href="mailto:openjfx-dev-retn@openjdk.org">mailto:openjfx-dev-retn@openjdk.org</a>] On Behalf
Of John Hendrikx<br>
Sent: Saturday, December 09, 2023 11:35 PM<br>
To: <a class="moz-txt-link-abbreviated" href="mailto:openjfx-dev@openjdk.org">openjfx-dev@openjdk.org</a><br>
Subject: Re: Converting a Color object to its
string representation<br>
<br>
I think this is too niche to have Color provide.<br>
<br>
Just make a utility method for whatever format
you desire, instead of <br>
making Color responsible for half a dozen ways
of formatting colors, and <br>
then probably still missing some format that
someone needs.<br>
<br>
Ticket should be closed as won't fix.<br>
<br>
--John<br>
<br>
On 09/12/2023 22:06, Michael Strauß wrote:<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt">I obviously meant to
write withPrefix("#"), not
withDelimiter("#")...<o:p></o:p></span></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt">On Sat, Dec 9, 2023
at 9:57 PM Michael Strauß
<a class="moz-txt-link-rfc2396E" href="mailto:michaelstrau2@gmail.com"><michaelstrau2@gmail.com></a> wrote:<o:p></o:p></span></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt">How would HexFormat
work with Color, other than using an
extremely<o:p></o:p></span></p>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt">unwieldy syntax?<o:p></o:p></span></p>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt"> String
formatted = HexFormat.of()<o:p></o:p></span></p>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt"> .withDelimiter("#")<o:p></o:p></span></p>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt"> .formatHex(new
byte[] {<o:p></o:p></span></p>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt"> (byte)(color.getRed()
* 255.0f),<o:p></o:p></span></p>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt"> (byte)(color.getGreen()
* 255.0f),<o:p></o:p></span></p>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt"> (byte)(color.getBlue()
* 255.0f),<o:p></o:p></span></p>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt"> (byte)(color.getOpacity()
* 255.0f)<o:p></o:p></span></p>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt"> });<o:p></o:p></span></p>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt">On Sat, Dec 9, 2023
at 9:40 PM David Alayachew
<a class="moz-txt-link-rfc2396E" href="mailto:davidalayachew@gmail.com"><davidalayachew@gmail.com></a> wrote:<o:p></o:p></span></p>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt">Apologies -
java.util.HexFormat<o:p></o:p></span></p>
</blockquote>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</blockquote>
</blockquote>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt">That's what I get
for firing from the hip, then looking
afterwards.<o:p></o:p></span></p>
</blockquote>
</blockquote>
</blockquote>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>