Verified Commit b15d573b authored by Zander Brown's avatar Zander Brown 🇬🇧
Browse files

Generate styles using sass

This lets us match gtk by actually using Adwaita
parent 7877d182
......@@ -89,6 +89,7 @@ dependencies = [
"libhandy 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sass-rs 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
......@@ -344,6 +345,14 @@ name = "memchr"
version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "num_cpus"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pango"
version = "0.7.0"
......@@ -394,6 +403,26 @@ dependencies = [
"ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "sass-rs"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
"sass-sys 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "sass-sys"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "thread_local"
version = "0.3.6"
......@@ -462,11 +491,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum locale_config 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "73ac19ebe45489e5d53b4346d8b90bb3dd03275c5fdf2ce22a982516d86b535c"
"checksum log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c275b6ad54070ac2d665eef9197db647b32239c9d244bfb6f041a766d00da5b3"
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
"checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273"
"checksum pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393fa071b144f8ffb83ede273758983cf414ca3c0b1d2a5a9ce325b3ba3dd786"
"checksum pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ee97abcad820f9875e032656257ad1c790e7b11a0e6ce2516a8f5b0d8f8213f"
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
"checksum regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d9d8297cc20bbb6184f8b45ff61c8ee6a9ac56c156cec8e38c3e5084773c44ad"
"checksum regex-syntax 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9b01330cce219c1c6b2e209e5ed64ccd587ae5c67bed91c0b49eecf02ae40e21"
"checksum sass-rs 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cabcf7c6e55053f359911187ac401409aad2dc14338cae972dec266fee486abd"
"checksum sass-sys 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6e16ac97c2335bc367e2d675f54c1823558f1b19a6c67671d48b70e30ae22972"
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86"
"checksum utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9d50aa7650df78abf942826607c62468ce18d9019673d4a2ebe1865dbb96ffde"
......
......@@ -14,3 +14,5 @@ gettext-rs= { version = "0.4.1", features = ["gettext-system"] }
libhandy = "0.4.0"
pango = "0.7.0"
colorsys = "0.5.1"
sass-rs = "0.2.2"
Adwaita taken from the gtk-3-24 branch of gtk
https://gitlab.gnome.org/GNOME/gtk/tree/gtk-3-24/gtk/theme/Adwaita
NOTE: gtk-contained.scss isn't actually used just kept for reference
and _colors.scss is modified from upstream to allow us to tweak colours
//apps rely on some named colors to be exported
/* GTK NAMED COLORS
----------------
use responsibly! */
// Sass thinks we're using the colors in the variables as strings and may shoot
// warning, it's innocuous and can be defeated by using "" + $var
/*
widget text/foreground color */
@define-color theme_fg_color #{"" +$fg_color};
/*
text color for entries, views and content in general */
@define-color theme_text_color #{"" +$text_color};
/*
widget base background color */
@define-color theme_bg_color #{"" +$bg_color};
/*
text widgets and the like base background color */
@define-color theme_base_color #{"" +$base_color};
/*
base background color of selections */
@define-color theme_selected_bg_color #{"" +$selected_bg_color};
/*
text/foreground color of selections */
@define-color theme_selected_fg_color #{"" +$selected_fg_color};
/*
base background color of insensitive widgets */
@define-color insensitive_bg_color #{"" +$insensitive_bg_color};
/*
text foreground color of insensitive widgets */
@define-color insensitive_fg_color #{"" +$insensitive_fg_color};
/*
insensitive text widgets and the like base background color */
@define-color insensitive_base_color #{"" +$base_color};
/*
widget text/foreground color on backdrop windows */
@define-color theme_unfocused_fg_color #{"" +$backdrop_fg_color};
/*
text color for entries, views and content in general on backdrop windows */
@define-color theme_unfocused_text_color #{"" +$text_color};
/*
widget base background color on backdrop windows */
@define-color theme_unfocused_bg_color #{"" +$backdrop_bg_color};
/*
text widgets and the like base background color on backdrop windows */
@define-color theme_unfocused_base_color #{"" +$backdrop_base_color};
/*
base background color of selections on backdrop windows */
@define-color theme_unfocused_selected_bg_color #{"" +$selected_bg_color};
/*
text/foreground color of selections on backdrop windows */
@define-color theme_unfocused_selected_fg_color #{"" + $selected_fg_color};
/*
insensitive color on backdrop windows*/
@define-color unfocused_insensitive_color #{"" + $backdrop_insensitive_color};
/*
widgets main borders color */
@define-color borders #{"" +$borders_color};
/*
widgets main borders color on backdrop windows */
@define-color unfocused_borders #{"" +$backdrop_borders_color};
/*
these are pretty self explicative */
@define-color warning_color #{"" +$warning_color};
@define-color error_color #{"" +$error_color};
@define-color success_color #{"" +$success_color};
//@define-color destructive_color #{$destructive_color}
//WM
$_wm_highlight: if($variant=='light', $top_hilight, // Sass gets mad if this is
transparentize(black,1)); // done directly in the
// color definition
/*
these colors are exported for the window manager and shouldn't be used in applications,
read if you used those and something break with a version upgrade you're on your own... */
@define-color wm_title shade(#{$fg_color}, 1.8);
@define-color wm_unfocused_title #{$backdrop_fg_color};
@define-color wm_highlight #{"" + $_wm_highlight};
@define-color wm_borders_edge #{"" + $borders_edge};
@define-color wm_bg_a shade(#{$bg_color}, 1.2);
@define-color wm_bg_b #{$bg_color};
@define-color wm_shadow alpha(black, 0.35);
@define-color wm_border alpha(black, 0.18);
@define-color wm_button_hover_color_a shade(#{$bg_color}, 1.3);
@define-color wm_button_hover_color_b #{$bg_color};
@define-color wm_button_active_color_a shade(#{$bg_color}, 0.85);
@define-color wm_button_active_color_b shade(#{$bg_color}, 0.89);
@define-color wm_button_active_color_c shade(#{$bg_color}, 0.9);
//FIXME this is really an API
@define-color content_view_bg #{"" + $base_color};
// When color definition differs for dark and light variant
// it gets @if ed depending on $variant
$base_color: desaturate({bg}, 20%);
$text_color: {fg};
$bg_color: {bg};
$fg_color: desaturate({fg}, 20%);
$selected_fg_color: lighten($text_color, 20%);
$selected_bg_color: darken($base_color, 40%);
$selected_borders_color: if($variant== 'light', darken($selected_bg_color, 15%), darken($selected_bg_color, 30%));
$borders_color: if($variant == 'light', darken($bg_color, 18%), darken($bg_color, 10%));
$alt_borders_color: if($variant == 'light', darken($bg_color, 24%), darken($bg_color, 18%));
$borders_edge: transparentize($base_color, 0.8);
$link_color: if($variant == 'light', darken($selected_bg_color, 10%), lighten($selected_bg_color, 20%));
$link_visited_color: if($variant == 'light', darken($selected_bg_color, 20%), lighten($selected_bg_color, 10%));
$top_hilight: $borders_edge;
$dark_fill: mix($borders_color, $bg_color, 50%);
$headerbar_color: if($variant == 'light', lighten($bg_color, 5%), darken($bg_color, 3%));
$menu_color: if($variant == 'light', $base_color, mix($bg_color, $base_color, 20%));
$popover_bg_color: $bg_color;
$popover_hover_color: lighten($bg_color, 5%);
$scrollbar_bg_color: if($variant == 'light', mix($bg_color, $fg_color, 80%), mix($base_color, $bg_color, 50%));
$scrollbar_slider_color: mix($fg_color, $bg_color, 60%);
$scrollbar_slider_hover_color: mix($fg_color, $bg_color, 80%);
$scrollbar_slider_active_color: if($variant=='light', darken($selected_bg_color, 10%), lighten($selected_bg_color, 10%));
$warning_color: #f57900;
$error_color: #cc0000;
$success_color: if($variant == 'light', #33d17a, darken(#33d17a, 10%));
$destructive_color: if($variant == 'light', #e01b24, darken(#e01b24, 10%));
$osd_fg_color: #eeeeec;
$osd_text_color: white;
$osd_bg_color: if($variant == 'light', transparentize(darken(desaturate(#3d3846, 100%), 4%),0.3), transparentize(darken(desaturate(#3d3846, 100%), 10%),0.3));
$osd_insensitive_bg_color: transparentize(mix($osd_fg_color, opacify($osd_bg_color, 1), 10%), 0.5);
$osd_insensitive_fg_color: mix($osd_fg_color, opacify($osd_bg_color, 1), 50%);
$osd_borders_color: transparentize(black, 0.3);
$sidebar_bg_color: mix($bg_color, $base_color, 50%);
$base_hover_color: transparentize($fg_color, 0.95);
$tooltip_borders_color: transparentize(white, 0.9);
$shadow_color: transparentize(black, 0.9);
$drop_target_color: #4e9a06;
//insensitive state derived colors
$insensitive_fg_color: mix($fg_color, $bg_color, 50%);
$insensitive_bg_color: mix($bg_color, $base_color, 60%);
$insensitive_borders_color: $borders_color;
//colors for the backdrop state, derived from the main colors.
$backdrop_base_color: if($variant == 'light', darken($base_color, 1%), lighten($base_color, 1%));
$backdrop_text_color: mix($text_color, $backdrop_base_color, 80%);
$backdrop_bg_color: $bg_color;
$backdrop_fg_color: mix($fg_color, $backdrop_bg_color, 50%);
$backdrop_insensitive_color: if($variant == 'light', darken($backdrop_bg_color, 15%), lighten($backdrop_bg_color, 15%));
$backdrop_selected_fg_color: if($variant == 'light', $backdrop_base_color, $backdrop_text_color);
$backdrop_borders_color: mix($borders_color, $bg_color, 80%);
$backdrop_dark_fill: mix($backdrop_borders_color, $backdrop_bg_color, 35%);
$backdrop_sidebar_bg_color: mix($backdrop_bg_color, $backdrop_base_color, 50%);
$backdrop_scrollbar_bg_color: darken($backdrop_bg_color, 3%);
$backdrop_scrollbar_slider_color: mix($backdrop_fg_color, $backdrop_bg_color, 40%);
$backdrop_menu_color: if($variant == 'light', $backdrop_base_color, mix($backdrop_bg_color, $backdrop_base_color, 20%));
//special cased widget colors
$suggested_bg_color: $selected_bg_color;
$suggested_border_color: $selected_borders_color;
$progress_bg_color: $selected_bg_color;
$progress_border_color: if($variant=='light', darken($progress_bg_color, 15%), darken($progress_bg_color, 30%));
$checkradio_bg_color: $bg_color;
$checkradio_fg_color: $fg_color;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment