Converting a Color object to its string representation
Michael Strauß
michaelstrau2 at gmail.com
Sat Dec 9 21:06:32 UTC 2023
I obviously meant to write withPrefix("#"), not withDelimiter("#")...
On Sat, Dec 9, 2023 at 9:57 PM Michael Strauß <michaelstrau2 at gmail.com> wrote:
>
> How would HexFormat work with Color, other than using an extremely
> unwieldy syntax?
>
> String formatted = HexFormat.of()
> .withDelimiter("#")
> .formatHex(new byte[] {
> (byte)(color.getRed() * 255.0f),
> (byte)(color.getGreen() * 255.0f),
> (byte)(color.getBlue() * 255.0f),
> (byte)(color.getOpacity() * 255.0f)
> });
>
>
>
> On Sat, Dec 9, 2023 at 9:40 PM David Alayachew <davidalayachew at gmail.com> wrote:
> >
> > Apologies - java.util.HexFormat
> >
> > That's what I get for firing from the hip, then looking afterwards.
More information about the openjfx-dev
mailing list