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