mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
config: improve validation of color values, default alpha to 0xff
Reject color values that aren't in either RGB, or ARGB format. That is, color values that aren't hexadecimal numbers with either 6 or 8 digits. Also, if a color value is allowed to have an alpha component, and the user left it out, default to 0xff (opaque) rather than 0x00 (fully transparent). Closes #1526
This commit is contained in:
parent
85a4e4ccc1
commit
02fff24b4f
3 changed files with 34 additions and 6 deletions
|
|
@ -426,6 +426,10 @@ test_color(struct context *ctx, bool (*parse_fun)(struct context *ctx),
|
|||
{"ffffff", 0xffffff},
|
||||
{"ffffffff", 0xffffffff, !alpha_allowed},
|
||||
{"aabbccdd", 0xaabbccdd, !alpha_allowed},
|
||||
{"00", 0, true},
|
||||
{"0000", 0, true},
|
||||
{"00000", 0, true},
|
||||
{"000000000", 0, true},
|
||||
{"unittest-invalid-color", 0, true},
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue