generated from hsbasu/template-repo
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add gnome-shell theme for mamolinux (#17)
- Copy from yaru - Modify panel to provide different colours in panel
- Loading branch information
Showing
221 changed files
with
11,233 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@function get_accent_color($accent_color, $is_dark: false) { | ||
$color: null; | ||
@if $accent_color == 'default' { | ||
$color: #0e8420; | ||
} @else if $accent_color == 'aqua' { | ||
$color: #6cabcd; | ||
} @else if $accent_color == 'blue' { | ||
$color: #5b73c4; | ||
} @else if $accent_color == 'brown' { | ||
$color: #aa876a; | ||
} @else if $accent_color == 'grey' { | ||
$color: #9d9d9d; | ||
} @else if $accent_color == 'orange' { | ||
$color: #E95420; | ||
} @else if $accent_color == 'pink' { | ||
$color: #c76199; | ||
} @else if $accent_color == 'purple' { | ||
$color: #8c6ec9; | ||
} @else if $accent_color == 'red' { | ||
$color: #DA3450; | ||
} @else if $accent_color == 'sand' { | ||
$color: #c8ac69; | ||
} @else if $accent_color == 'teal' { | ||
$color: #5aaa9a; | ||
} @else { | ||
@error('No known accent color defined!'); | ||
} | ||
@debug('Using accent color ' + $accent_color + ': ' + $color); | ||
@return $color; | ||
} | ||
|
||
$yaru_is_dark_variant: @yaru_dark_variant@; | ||
$yaru_accent_bg_color: get_accent_color('@yaru_accent_color@', $yaru_is_dark_variant); | ||
$accent_bg_color: $yaru_accent_bg_color; | ||
$accent_color: $yaru_accent_bg_color; | ||
@debug("Accent color is " + $yaru_accent_bg_color); | ||
|
||
@import '@yaru_theme_entry_point@' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright © 2022, Canonical Ltd | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
# License as published by the Free Software Foundation; either | ||
# version 2.1 of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
# Authors: | ||
# Marco Trevisan <[email protected]> | ||
|
||
import argparse | ||
import fnmatch | ||
import os | ||
|
||
from glob import glob | ||
|
||
# Keep this in sync with yaru-colors-defs.scss, or the input CSS in use. | ||
DUMMY_COLORS = { | ||
'accent-bg-color': '#00ff01', | ||
'accent-active-color': '#00ff02', | ||
'accent-border-color': '#ff0001', | ||
'accent-focused-color': '#0101ff', | ||
'bg-color': '#ffff00', | ||
'border-color': '#ff00ff', | ||
'disabled-bg-color': '#ffff02', | ||
'switch-bg-color': '#ffff01', | ||
'check-bg-color': '#ffff03', | ||
} | ||
|
||
def read_colors_replacements(css_file): | ||
colors_replacements = {} | ||
|
||
for l in css_file.readlines(): | ||
for line in l.split('//')[0].split(';'): | ||
if '-yaru-' not in line: | ||
continue | ||
|
||
[named_color, color] = line.split('-yaru-', 1)[-1].split(': ') | ||
colors_replacements[DUMMY_COLORS[named_color]] = color | ||
print(named_color, color, f'(replaces {DUMMY_COLORS[named_color]})') | ||
|
||
return colors_replacements | ||
|
||
def replace_colors(svg, replacements, output_folder, variant): | ||
with open(svg, 'r') as f: | ||
contents = f.read() | ||
for dummy, color in replacements.items(): | ||
contents = contents.replace(dummy, color) | ||
|
||
output_folder = os.path.abspath(output_folder) | ||
basename = os.path.basename(svg).rsplit('.', 1)[0] | ||
finalname = f'{basename}-{variant}.svg' if variant else f'{basename}.svg' | ||
output_path = os.path.join(output_folder, finalname) | ||
print(f'Processing {os.path.basename(svg)} => {output_path}') | ||
|
||
os.makedirs(output_folder, exist_ok=True) | ||
with open(output_path, 'w') as out: | ||
out.write(contents) | ||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('yaru_colors_defs_scss', type=argparse.FileType('r')) | ||
parser.add_argument('--input-file', default=None) | ||
parser.add_argument('--assets-path', default='.') | ||
parser.add_argument('--output-folder', default='.') | ||
parser.add_argument('--variant', default=None) | ||
parser.add_argument('--filter', action='append', default=[]) | ||
parser.add_argument('--exclude', action='append', default=[]) | ||
|
||
args = parser.parse_args() | ||
replacements = read_colors_replacements(args.yaru_colors_defs_scss) | ||
variant = None if args.variant == 'default' else args.variant | ||
|
||
if args.input_file: | ||
replace_colors(args.input_file, replacements, | ||
args.output_folder, variant) | ||
else: | ||
for svg in glob(os.path.join(os.path.abspath(args.assets_path), '*.svg')): | ||
if [fl for fl in args.exclude if fnmatch.fnmatch(svg, fl)]: | ||
continue | ||
|
||
if args.filter and not [fl for fl in args.filter if fnmatch.fnmatch(svg, fl)]: | ||
continue | ||
|
||
replace_colors(svg, replacements, args.output_folder, variant) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
colorize_dummy_svg = find_program('colorize-dummy-svg.py') | ||
accent_colors_definitions_scss = meson.project_source_root() / '@0@'.format(files('accent-colors.scss.in')[0]) | ||
yaru_colors_defs_scss = meson.project_source_root() / '@0@'.format(files('yaru-colors-defs.scss')[0]) | ||
|
||
sass_utils_scss = files([ | ||
'sass-utils.scss', | ||
]) | ||
|
||
test('sass-utils', | ||
sassc, | ||
args: [ | ||
files('test-sass-utils.scss'), | ||
'/dev/null', | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// Copyright © 2022, Canonical Ltd | ||
// | ||
// This program is free software; you can redistribute it and/or | ||
// modify it under the terms of the GNU Lesser General Public | ||
// License as published by the Free Software Foundation; either | ||
// version 2.1 of the License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
// Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public | ||
// License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
// Authors: | ||
// Marco Trevisan <[email protected]> | ||
|
||
@function str-contains($str, $substring) { | ||
@return str-index($str, $substring) != null; | ||
} | ||
|
||
@function str-starts-with($str, $substring) { | ||
@return str-index($str, $substring) == 1; | ||
} | ||
|
||
@function str-ends-with($str, $substring) { | ||
$index: str-index($str, $substring); | ||
@if ($index == null) { | ||
@return false; | ||
} | ||
|
||
@return ($index + str-length($substring) - 1) == str-length($str); | ||
} | ||
|
||
@function str-basename($str, $divider: '/') { | ||
$index: str-index($str, $divider); | ||
|
||
@while $index != null { | ||
$str: str-slice($str, $index + 1); | ||
$index: str-index($str, $divider); | ||
} | ||
|
||
@return $str; | ||
} | ||
|
||
@function str-extension($str) { | ||
$extension: str-basename($str, '.'); | ||
@return if($extension == $str, null, $extension); | ||
} | ||
|
||
@function str-dirname($str, $divider: '/') { | ||
$str_copy: $str; | ||
$index: str-index($str, $divider); | ||
$last_index: null; | ||
|
||
@while $index != null { | ||
$str: str-slice($str, $index + 1); | ||
$last_index: if($last_index, $last_index, 0) + $index; | ||
$index: str-index($str, $divider); | ||
} | ||
|
||
@return if($last_index, str-slice($str_copy, 1, $last_index - 1), '.'); | ||
} | ||
|
||
@function list-length($list) { | ||
$i: 0; | ||
@each $e in $list { | ||
$i: $i + 1; | ||
} | ||
|
||
@return $i; | ||
} | ||
|
||
@function list-nth($list, $nth) { | ||
$i: 0; | ||
|
||
@if $nth < 0 { | ||
$nth: list-length($list) + $nth; | ||
} | ||
|
||
@each $e in $list { | ||
@if ($i == $nth) { | ||
@return $e; | ||
} | ||
|
||
$i: $i + 1; | ||
} | ||
|
||
@return null; | ||
} | ||
|
||
@function list-index($list, $item) { | ||
$i: 0; | ||
@each $e in $list { | ||
@if ($e == $item) { | ||
@return $i; | ||
} | ||
|
||
$i: $i + 1; | ||
} | ||
|
||
@return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// Copyright © 2022, Canonical Ltd | ||
// | ||
// This program is free software; you can redistribute it and/or | ||
// modify it under the terms of the GNU Lesser General Public | ||
// License as published by the Free Software Foundation; either | ||
// version 2.1 of the License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
// Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public | ||
// License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
// Authors: | ||
// Marco Trevisan <[email protected]> | ||
|
||
@import 'sass-utils'; | ||
|
||
@function assert($result, $expected: true) { | ||
@if $result != $expected { | ||
$result: if($result == null, 'null', $result); | ||
$expected: if($expected == null, 'null', $expected); | ||
@error "Assertion failed, expected '" + $expected + "', got '" + $result + "'"; | ||
} | ||
|
||
@return '' | ||
} | ||
|
||
@function test($name, $result, $expected: true) { | ||
@return 'Running test '+$name + assert($result, $expected); | ||
} | ||
|
||
@function run-test($function, $expected, $args...) { | ||
@return test($function, $function($args), $expected); | ||
} | ||
|
||
@debug test('str-contains Empty', str-contains('', '')); | ||
@debug test('str-contains Empty one', str-contains('', 'foo'), false); | ||
@debug test('str-contains Empty substring', str-contains('foo', ''), true); | ||
@debug test('str-contains Valid', str-contains('foo bar baz', 'bar'), true); | ||
@debug test('str-contains Missing', str-contains('foo bar', 'baz'), false); | ||
|
||
@debug test('str-starts-with Empty', str-starts-with('', '')); | ||
@debug test('str-starts-with Empty Both', str-starts-with('foo', '')); | ||
@debug test('str-starts-with Valid', str-starts-with('foobar', 'foo')); | ||
@debug test('str-starts-with Valid full', str-starts-with('foobar', 'foobar')); | ||
@debug test('str-starts-with Invalid', str-starts-with('barfoo', 'foo'), false); | ||
|
||
@debug test('str-ends-with Empty', str-ends-with('', '')); | ||
@debug test('str-ends-with Empty Both', str-ends-with('foo', ''), false); | ||
@debug test('str-ends-with Valid', str-ends-with('foobar', 'bar')); | ||
@debug test('str-ends-with Valid full', str-ends-with('foobar', 'foobar')); | ||
@debug test('str-ends-with Invalid', str-ends-with('foobar', 'foo'), false); | ||
|
||
@debug test('str-basename, Empty', str-basename(''), ''); | ||
@debug test('str-basename, Named', str-basename('foo'), 'foo'); | ||
@debug test('str-basename, Valid', str-basename('/foo/bar'), 'bar'); | ||
@debug test('str-basename, Valid', str-basename('/foo/bar/baz'), 'baz'); | ||
@debug test('str-basename, Valid', str-basename('proto:///foo/bar/baz'), 'baz'); | ||
|
||
@debug test('str-extension, Empty', str-extension(''), null); | ||
@debug test('str-extension, Named', str-extension('foo'), null); | ||
@debug test('str-extension, Valid', str-extension('/foo.bar'), 'bar'); | ||
@debug test('str-extension, Valid', str-extension('/foo/bar.baz'), 'baz'); | ||
|
||
@debug test('str-dirname, Empty', str-dirname(''), '.'); | ||
@debug test('str-dirname, Named', str-dirname('foo'), '.'); | ||
@debug test('str-dirname, Valid', str-dirname('/foo/bar'), '/foo'); | ||
@debug test('str-dirname, Valid', str-dirname('/foo/bar/baz'), '/foo/bar'); | ||
@debug test('str-dirname, Valid', str-dirname('proto:///foo/bar/baz'), 'proto:///foo/bar'); | ||
|
||
@debug test('list-length, Empty', list-length([]), 0); | ||
@debug test('list-length, One', list-length([1]), 1); | ||
@debug test('list-length, Two', list-length([1, '2']), 2); | ||
|
||
@debug test('list-nth, Empty', list-nth([], 0), null); | ||
@debug test('list-nth, Empty', list-nth([], 10), null); | ||
@debug test('list-nth, Empty', list-nth([], -10), null); | ||
@debug test('list-nth, One, valid', list-nth([1], 0), 1); | ||
@debug test('list-nth, One, valid negative', list-nth([1], -1), 1); | ||
@debug test('list-nth, One, invalid', list-nth([1], 3), null); | ||
@debug test('list-nth, One, invalid negative', list-nth([1], -3), null); | ||
@debug test('list-nth, Three, valid', list-nth([1, '2', false], 0), 1); | ||
@debug test('list-nth, Three, valid negative', list-nth([1, '2', false], -1), false); | ||
@debug test('list-nth, Three, valid', list-nth([1, '2', false], 1), '2'); | ||
@debug test('list-nth, Three, valid negative', list-nth([1, '2', false], -2), '2'); | ||
@debug test('list-nth, Three, valid', list-nth([1, '2', false], 2), false); | ||
@debug test('list-nth, Three, valid negative', list-nth([1, '2', false], -3), 1); | ||
|
||
@debug test('list-index, Empty', list-index([], 0), null); | ||
@debug test('list-index, Empty', list-index([], 10), null); | ||
@debug test('list-index, Empty', list-index([], -10), null); | ||
@debug test('list-index, One, valid', list-index([1], 1), 0); | ||
@debug test('list-index, One, invalid', list-index([1], 3), null); | ||
@debug test('list-index, Three, valid', list-index([1, '2', false], 1), 0); | ||
@debug test('list-index, Three, valid', list-index([1, '2', false], '2'), 1); | ||
@debug test('list-index, Three, valid', list-index([1, '2', false], false), 2); |
Oops, something went wrong.