mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
lib/parsecolor: add magenta
This commit is contained in:
1 parent
f731cfc72f
commit
a3ae753865
3 files changed
+11
-4
No files matched your search
@@ -133,7 +133,10 @@ var offsets = [...]uint32{
|
||||
0x43FF9800, // orange
|
||||
0x48795548, // brown
|
||||
0x4C9E9E9E, // gray
|
||||
|
||||
// Ad-hoc synonyms for some of the official Material Design names.
|
||||
0x509E9E9E, // grey
|
||||
0x579C27B0, // magenta
|
||||
}
|
||||
|
||||
const names = "blackwhiteredpinkpurpleindigobluecyantealgreenlimeyellowamberorangebrowngraygrey"
|
||||
const names = "blackwhiteredpinkpurpleindigobluecyantealgreenlimeyellowamberorangebrowngraygreymagenta"
|
||||
@@ -30,6 +30,7 @@ func TestParse(tt *testing.T) {
|
||||
{color.NRGBA{0xff, 0x98, 0x00, 0xff}, true, "orange"},
|
||||
{color.NRGBA{0xcf, 0xcf, 0xcf, 0xff}, true, "lightgray"},
|
||||
{color.NRGBA{0x9e, 0x9e, 0x9e, 0xff}, true, "grey"},
|
||||
{color.NRGBA{0x9c, 0x27, 0xb0, 0xff}, true, "magenta"},
|
||||
|
||||
{color.NRGBA{0xab, 0xc1, 0x23, 0xff}, true, "#abc123"},
|
||||
{color.NRGBA{0xab, 0xc1, 0x23, 0xff}, true, "abc123"},
|
||||
|
||||
@@ -95,8 +95,8 @@ parse_color(const char* s_ptr, size_t s_len) {
|
||||
b_len -= 5;
|
||||
}
|
||||
|
||||
static const int num_offsets = 18;
|
||||
static const uint32_t offsets[18] = {
|
||||
static const int num_offsets = 19;
|
||||
static const uint32_t offsets[19] = {
|
||||
0x00000000u, //
|
||||
0x05000000u, // black
|
||||
0x0AFFFFFFu, // white
|
||||
@@ -114,12 +114,15 @@ parse_color(const char* s_ptr, size_t s_len) {
|
||||
0x43FF9800u, // orange
|
||||
0x48795548u, // brown
|
||||
0x4C9E9E9Eu, // gray
|
||||
|
||||
// Ad-hoc synonyms for some of the official Material Design names.
|
||||
0x509E9E9Eu, // grey
|
||||
0x579C27B0u, // magenta
|
||||
};
|
||||
|
||||
static const char names[] =
|
||||
"blackwhiteredpinkpurpleindigobluecyantealgreenlimeyellowamberorangebro"
|
||||
"wngraygrey";
|
||||
"wngraygreymagenta";
|
||||
|
||||
for (int i = 1; i < num_offsets; i++) {
|
||||
size_t name_len = (offsets[i] >> 24) - (offsets[i - 1] >> 24);
|
||||
|
||||
Reference in new issue
Block a user