Skip to content

Commit

Permalink
Add initial support for Gtk4 and libhandy
Browse files Browse the repository at this point in the history
  • Loading branch information
ochosi committed Mar 19, 2022
1 parent 1c0b0ec commit 584cace
Show file tree
Hide file tree
Showing 96 changed files with 8,425 additions and 53 deletions.
773 changes: 773 additions & 0 deletions light/gtk-3.0/_libhandy.scss

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions light/gtk-3.0/gtk-dark.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$variant: 'dark';

@import 'colors';
@import 'drawing';
@import 'common';
@import 'colors-public';
@import 'gnome-apps';
@import 'lightdm-gtk-greeter';
@import 'others';
@import 'unity';
@import 'xfce';
@import 'libhandy';
12 changes: 12 additions & 0 deletions light/gtk-3.0/gtk.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$variant: 'light';

@import 'colors';
@import 'drawing';
@import 'common';
@import 'colors-public';
@import 'gnome-apps';
@import 'lightdm-gtk-greeter';
@import 'others';
@import 'unity';
@import 'xfce';
@import 'libhandy';
41 changes: 41 additions & 0 deletions light/gtk-3.0/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
gtk3_dir = join_paths(theme_path, 'gtk-3.0')

# theme sources .scss files

# The files that need to be compiled
gtk3_scss_sources = [
'gtk',
'gtk-dark'
]

# Dependencies of the files that need to be compiled
gtk3_scss_dependencies = [
'_colors-public.scss',
'_colors.scss',
'_common.scss',
'_drawing.scss',
'_gnome-apps.scss',
'_lightdm-gtk-greeter.scss',
'_others.scss',
'_unity.scss',
'_xfce.scss',
'_libhandy.scss'
]

# Generate .css files and install
gtk3_scss_dependencies = files(gtk3_scss_dependencies)
#
foreach f : gtk3_scss_sources
custom_target('greybird-generate_' + f,
input: f + '.scss',
output: f + '.css',
depend_files: gtk3_scss_dependencies,
command: [sassc, '-M', '-t', 'compact', '@INPUT@', '@OUTPUT@'],
build_by_default: true,
install: true,
install_dir: gtk3_dir,
)
endforeach

# Install asset files to themes/ThemeName/gtk-3.0/assets
install_subdir('assets', install_dir : gtk3_dir, strip_directory : false)
2 changes: 2 additions & 0 deletions light/gtk-4.0/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source 'https://rubygems.org'
gem "sass", "~> 3.4.0"
35 changes: 35 additions & 0 deletions light/gtk-4.0/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Summary
-------

* Do not edit the CSS directly, edit the source SCSS files and process them with SASS (run
`./parse-sass.sh` when you have the required software installed, as described below)
* To be able to use the latest/adequate version of sass, install ruby, gem, sass & bundler.
On Fedora F20, this is done with `sudo dnf install rubygems && gem install bundle && bundle install`
from the same directory this README resides in.

How to tweak the theme
----------------------

Greybird is a complex theme (based on Adwaita), so to keep it maintainable it's written and processed
in SASS.

It is very likely your change will happen in the _common.scss file. That's where all the widget
selectors are defined. Here's a rundown of the "supporting" stylesheets, that are unlikely to be the
right place for a drive by stylesheet fix:

_colors.scss - global color definitions. We keep the number of defined colors to a necessary minimum,
most colors are derived form a handful of basics. It covers both the light variant and
the dark variant.

_colors-public.scss - SCSS colors exported through gtk to allow for 3rd party apps color mixing.

_drawing.scss - drawing helper mixings/functions to allow easier definition of widget drawing under
specific context. This is why Adwaita isn't 15000 LOC.

_common.scss - actual definitions of style for each widget. This is where you are likely to add/remove
your changes.

You can read about SASS at http://sass-lang.com/documentation/. Once you make your changes to the
_common.scss file, you can either run the ./parse-sass.sh script or keep SASS watching for changes as you
edit. This is done by running `bundle exec sass --watch --sourcemap=none .` If sass is out of date, or is
missing, you can install it with `bundle install`.
112 changes: 112 additions & 0 deletions light/gtk-4.0/_colors-public.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
//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};

/*
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};

72 changes: 72 additions & 0 deletions light/gtk-4.0/_colors.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// When color definition differs for dark and light variant
// it gets @if ed depending on $variant


$base_color: if($variant == 'light', #fcfcfc, #2d2e30);
$text_color: if($variant == 'light', #212121, white);
$bg_color: if($variant == 'light', #cecece, #3b3e3f);
$fg_color: if($variant == 'light', #3c3c3c, #eeeeec);

$selected_fg_color: #ffffff;
$selected_bg_color: if($variant == 'light', #398ee7, darken(#398ee7,20%));
$selected_borders_color: if($variant== 'light', darken($selected_bg_color, 30%), darken($selected_bg_color, 20%));
$borders_color: if($variant == 'light', darken($bg_color,30%), darken($bg_color,12%));
$borders_edge: if($variant == 'light', transparentize(white, 0.2), transparentize($fg_color, 0.93));
$link_color: if($variant == 'light', #2d71b8, lighten(#2d71b8,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, 35%);
$headerbar_color: if($variant == 'light', $bg_color, darken($bg_color, 3%));
$menu_color: if($variant == 'light', lighten($bg_color, 18%), mix($bg_color, $base_color, 20%));
$popover_bg_color: lighten($bg_color, 18%);
$popover_hover_color: $selected_bg_color;

$scrollbar_bg_color: if($variant == 'light', mix($bg_color, $fg_color, 80%), mix($base_color, $bg_color, 50%));
$scrollbar_slider_color: $bg_color;
$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', #4e9a06, darken(#4e9a06,10%));
$destructive_color: if($variant == 'light', #ef2929, darken(#ef2929,10%));

$osd_fg_color: #eeeeee;
$osd_text_color: white;
$osd_bg_color: transparentize(#222, 0.2);
$osd_insensitive_bg_color: transparentize(#222, 0.2);
$osd_insensitive_fg_color: mix($osd_fg_color, opacify($osd_bg_color, 1), 50%);
$osd_borders_color: transparentize(black, 0.3);

$sidebar_bg_color: if($variant == 'light', #dae0e6, #222);
$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;

$panel_bg_color: #686868;
$panel_fg_color: #fcfcfc;

//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', darken($base_color, 50%), $backdrop_text_color);
$backdrop_selected_bg_color: if($variant == 'light', darken($base_color, 17%), lighten($bg_color, 17%));
$backdrop_borders_color: mix($borders_color, $bg_color, 90%);
$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: lighten($scrollbar_slider_color, 35%);

$backdrop_menu_color: if($variant == 'light', $backdrop_base_color, mix($backdrop_bg_color, $backdrop_base_color, 20%));
Loading

0 comments on commit 584cace

Please sign in to comment.