Compare commits
2 Commits
b5ef86d092
...
eb62e9ad72
Author | SHA1 | Date | |
---|---|---|---|
eb62e9ad72 | |||
34d078b524 |
@ -27,11 +27,11 @@ const Style DEFAULT_STYLE = {
|
|||||||
.radius = 0,
|
.radius = 0,
|
||||||
.size = 16,
|
.size = 16,
|
||||||
|
|
||||||
.bg = 0x282828ffu.@to_rgba(),
|
.bg = 0x282828ffu.@to_rgba(),
|
||||||
.fg = 0xfbf1c7ffu.@to_rgba(),
|
.fg = 0xfbf1c7ffu.@to_rgba(),
|
||||||
.primary = 0xcc241dffu.@to_rgba(),
|
.primary = 0xcc241dffu.@to_rgba(),
|
||||||
.secondary = 0x458588ffu.@to_rgba(),
|
.secondary = 0x458588ffu.@to_rgba(),
|
||||||
.accent = 0xfabd2fffu.@to_rgba(),
|
.accent = 0xfabd2fffu.@to_rgba(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// style is stored in a hashmap, each style has an Id that can be generated by a string or whatever
|
// style is stored in a hashmap, each style has an Id that can be generated by a string or whatever
|
||||||
@ -211,14 +211,16 @@ fn Token Lexer.next_token(&lex)
|
|||||||
while (ascii::is_alnum_m(lex.peep())) {
|
while (ascii::is_alnum_m(lex.peep())) {
|
||||||
if (lex.advance() == 0) { t.type = INVALID; break; }
|
if (lex.advance() == 0) { t.type = INVALID; break; }
|
||||||
}
|
}
|
||||||
if (lex.off - hex_start != 8) {
|
usz h_len = lex.off - hex_start;
|
||||||
io::eprintfn("CSS lexing error at %d:%d: the only suppported color format is #RRGGBBAA", t.line, t.col);
|
if (h_len != 8 && h_len != 6) {
|
||||||
|
io::eprintfn("CSS lexing error at %d:%d: the only suppported color formats are #RRGGBBAA or #RRGGBB", t.line, t.col);
|
||||||
t.type = INVALID;
|
t.type = INVALID;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
char[10] hex_str = (char[])"0x";
|
char[10] hex_str = (char[])"0x";
|
||||||
hex_str[2..] = lex.text[hex_start..lex.off-1];
|
hex_str[2:h_len] = lex.text[hex_start:h_len];
|
||||||
|
if (h_len == 6) hex_str[8..9] = "ff"[..];
|
||||||
uint? color_hex = ((String)hex_str[..]).to_uint();
|
uint? color_hex = ((String)hex_str[..]).to_uint();
|
||||||
if (catch color_hex) {
|
if (catch color_hex) {
|
||||||
t.type = INVALID;
|
t.type = INVALID;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
div {
|
div {
|
||||||
bg: #282828ff;
|
bg: #282828;
|
||||||
fg: #fbf1c7ff;
|
fg: #fbf1c7ff;
|
||||||
primary: #cc241dff;
|
primary: #cc241dff;
|
||||||
secondary: #6c19ca8f;
|
secondary: #6c19ca8f;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user