mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-27 11:16:03 +00:00
Updated style file format
This commit is contained in:
parent
bfccae1b8e
commit
89221fae55
@ -1,14 +1,29 @@
|
|||||||
background = "#3465a4"
|
# Everything in a theme file is optional.
|
||||||
shadow = "#000000"
|
|
||||||
|
shadow = false
|
||||||
|
borders = "simple", # Alternatives are "none" and "outset"
|
||||||
|
|
||||||
|
# Base colors are red, green, blue,
|
||||||
|
# cyan, magenta, yellow, white and black.
|
||||||
|
[colors]
|
||||||
|
background = "black"
|
||||||
|
# If the value is an array, the first valid color will be used.
|
||||||
|
# If the terminal doesn't support custom color,
|
||||||
|
# non-base colors will be skipped.
|
||||||
|
shadow = ["#000000", "black"]
|
||||||
view = "#d3d7cf"
|
view = "#d3d7cf"
|
||||||
|
|
||||||
primary = "#111111"
|
# Array and simple values have the same effect.
|
||||||
|
primary = ["#111111"]
|
||||||
secondary = "#EEEEEE"
|
secondary = "#EEEEEE"
|
||||||
tertiary = "#444444"
|
tertiary = "#444444"
|
||||||
|
|
||||||
|
# Hex values can use lower or uppercase.
|
||||||
|
# (base color MUST be lowercase)
|
||||||
title_primary = "#ff5555"
|
title_primary = "#ff5555"
|
||||||
title_secondary = "#ffff55"
|
title_secondary = "#ffff55"
|
||||||
|
|
||||||
highlight = "#FF0000"
|
# Lower precision values can use only 3 digits.
|
||||||
|
highlight = "#F00"
|
||||||
highlight_inactive = "#5555FF"
|
highlight_inactive = "#5555FF"
|
||||||
|
|
||||||
|
12
src/color.rs
12
src/color.rs
@ -133,15 +133,15 @@ impl Color {
|
|||||||
if s.starts_with("#") {
|
if s.starts_with("#") {
|
||||||
let s = &s[1..];
|
let s = &s[1..];
|
||||||
// HTML-style
|
// HTML-style
|
||||||
let l = match s.len() {
|
let (l,max) = match s.len() {
|
||||||
6 => 2,
|
6 => (2,255),
|
||||||
3 => 1,
|
3 => (1,15),
|
||||||
_ => panic!("Cannot parse color: {}", s),
|
_ => panic!("Cannot parse color: {}", s),
|
||||||
};
|
};
|
||||||
|
|
||||||
self.r = (load_hex(&s[0*l..1*l]) as i32 * 1000 / 255) as i16;
|
self.r = (load_hex(&s[0*l..1*l]) as i32 * 1000 / max) as i16;
|
||||||
self.g = (load_hex(&s[1*l..2*l]) as i32 * 1000 / 255) as i16;
|
self.g = (load_hex(&s[1*l..2*l]) as i32 * 1000 / max) as i16;
|
||||||
self.b = (load_hex(&s[2*l..3*l]) as i32 * 1000 / 255) as i16;
|
self.b = (load_hex(&s[2*l..3*l]) as i32 * 1000 / max) as i16;
|
||||||
} else {
|
} else {
|
||||||
// Unknown color. Panic.
|
// Unknown color. Panic.
|
||||||
panic!("Cannot parse color: {}", s);
|
panic!("Cannot parse color: {}", s);
|
||||||
|
Loading…
Reference in New Issue
Block a user