Skip to content

Consolidate methods for converting colors to/from hex strings#1626

Merged
cameronwhite merged 1 commit into
masterfrom
fix/hex-parsing
Jul 22, 2025
Merged

Consolidate methods for converting colors to/from hex strings#1626
cameronwhite merged 1 commit into
masterfrom
fix/hex-parsing

Conversation

@cameronwhite

Copy link
Copy Markdown
Member
  • Remove the ColorBgra hex conversion methods in favour of the ones in Cairo.Color. In the palette manager this was a source of conversions between ColorBgra and Cairo.Color which didn't convert between premultiplied alpha, which we want to eliminate for bug Fix error-prone usage of ColorBgra with straight vs premultiplied alpha #1553. There was also no need for having duplicate logic for this in different color types

  • Since ColorBgra.TohexString() didn't produce a hex string in RGBA order, we need some simple wrappers to reorder the color channels. This preserves compatibility when loading existing settings from disk

  • Fix the Cairo.Color tests to include alpha when parsing hex strings, and add tests for converting to hex

- Remove the `ColorBgra` hex conversion methods in favour of the ones in `Cairo.Color`. In the palette manager this was a source of conversions between ColorBgra and Cairo.Color which didn't convert between premultiplied alpha, which we want to eliminate for bug #1553. There was also no need for having duplicate logic for this in different color types

- Since `ColorBgra.TohexString()` didn't produce a hex string in RGBA order, we need some simple wrappers to reorder the color channels. This preserves compatibility when loading existing settings from disk

- Fix the `Cairo.Color` tests to include alpha when parsing hex strings, and add tests for converting to hex
@cameronwhite cameronwhite merged commit 9b4d7c2 into master Jul 22, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant