Compare commits

..

12 Commits

14 changed files with 568 additions and 52 deletions

View File

@@ -61,4 +61,7 @@ You can read the manual [in your browser](./doc/manual.md) or by running `shchem
This software is a work of opportunism
- [mo](https://github.com/tests-always-included/mo) - Mustache templates in bash. Shchemes wouldn't be possible without it.
- [tinted-theming/schemes](https://github.com/tinted-theming/schemes) - Pretty much all the base16 themes
- [tinted-theming/schemes](https://github.com/tinted-theming/schemes) - Several base16 themes
- [deathbeam/base16-discord](https://github.com/deathbeam/base16-discord) - The base16 `better-discord` target
- [mk12/base16-kitty](https://github.com/mk12/base16-kitty) - The base16 `kitty` target

View File

@@ -6,32 +6,32 @@ draw_bold_text_with_bright_colors = false
# Default colors
[colors.primary]
background = '0x{{base00}}'
foreground = '0x{{base05}}'
background = "#{{base00}}"
foreground = "#{{base05}}"
# Colors the cursor will use if `custom_cursor_colors` is true
[colors.cursor]
text = '0x{{base00}}'
cursor = '0x{{base05}}'
text = "#{{base00}}"
cursor = "#{{base05}}"
# Normal colors
[colors.normal]
black = '0x{{base00}}'
red = '0x{{base08}}'
green = '0x{{base0B}}'
yellow = '0x{{base0A}}'
blue = '0x{{base0D}}'
magenta = '0x{{base0E}}'
cyan = '0x{{base0C}}'
white = '0x{{base05}}'
black = "#{{base00}}"
red = "#{{base08}}"
green = "#{{base0B}}"
yellow = "#{{base0A}}"
blue = "#{{base0D}}"
magenta = "#{{base0E}}"
cyan = "#{{base0C}}"
white = "#{{base05}}"
# Bright colors
[colors.bright]
black = '0x{{base03}}'
red = '0x{{base09}}'
green = '0x{{base01}}'
yellow = '0x{{base02}}'
blue = '0x{{base04}}'
magenta = '0x{{base06}}'
cyan = '0x{{base0F}}'
white = '0x{{base07}}'
black = "#{{base03}}"
red = "#{{base09}}"
green = "#{{base01}}"
yellow = "#{{base02}}"
blue = "#{{base04}}"
magenta = "#{{base06}}"
cyan = "#{{base0F}}"
white = "#{{base07}}"

View File

@@ -0,0 +1,54 @@
/**
* @name base16 {{scheme-name}}
* @author {{scheme-author}}
* @version 1.0.0
* @description base16 {{scheme-name}} theme generated from https://github.com/tinted-theming/schemes
**/
:root {
--base00: #{{base00}}; /* Black */
--base01: #{{base01}}; /* Bright Black */
--base02: #{{base02}}; /* Grey */
--base03: #{{base03}}; /* Brighter Grey */
--base04: #{{base04}}; /* Bright Grey */
--base05: #{{base05}}; /* White */
--base06: #{{base06}}; /* Brighter White */
--base07: #{{base07}}; /* Bright White */
--base08: #{{base08}}; /* Red */
--base09: #{{base09}}; /* Orange */
--base0A: #{{base0A}}; /* Yellow */
--base0B: #{{base0B}}; /* Green */
--base0C: #{{base0C}}; /* Cyan */
--base0D: #{{base0D}}; /* Blue */
--base0E: #{{base0E}}; /* Purple */
--base0F: #{{base0F}}; /* Magenta */
--primary-630: var(--base00); /* Autocomplete background */
--primary-660: var(--base00); /* Search input background */
}
.theme-light, .theme-dark {
--search-popout-option-fade: none; /* Disable fade for search popout */
--bg-overlay-2: var(--base00); /* These 2 are needed for proper threads coloring */
--home-background: var(--base00);
--background-primary: var(--base00);
--background-secondary: var(--base01);
--background-secondary-alt: var(--base01);
--channeltextarea-background: var(--base01);
--background-tertiary: var(--base00);
--background-accent: var(--base0E);
--background-floating: var(--base01);
--background-modifier-selected: var(--base00);
--text-normal: var(--base05);
--text-secondary: var(--base00);
--text-muted: var(--base03);
--text-link: var(--base0C);
--interactive-normal: var(--base05);
--interactive-hover: var(--base0C);
--interactive-active: var(--base0A);
--interactive-muted: var(--base03);
--header-primary: var(--base06);
--header-secondary: var(--base03);
--scrollbar-thin-track: transparent;
--scrollbar-auto-track: transparent;
}

View File

@@ -1,3 +1,3 @@
bspc config normal_border_color "#{{base01}}"
bspc config active_border_color "#{{base04}}"
bspc config focused_border_color "#{{base0C}}"
bspc config normal_border_color "#{{base02}}"
bspc config active_border_color "#{{base03}}"
bspc config focused_border_color "#{{base04}}"

View File

@@ -0,0 +1,27 @@
# :root {
# --vii: #{{base01}};
# --vi: #{{base03}};
# --v: #{{base08}};
# --iv: #{{base05}};
# --iiv: #{{base07}};
# --a: #{{base0C}};
# }
:root {
--base00: #{{base00}};
--base01: #{{base01}};
--base02: #{{base02}};
--base03: #{{base03}};
--base04: #{{base04}};
--base05: #{{base05}};
--base06: #{{base06}};
--base07: #{{base07}};
--base08: #{{base08}};
--base09: #{{base09}};
--base0A: #{{base0A}};
--base0B: #{{base0B}};
--base0C: #{{base0C}};
--base0D: #{{base0D}};
--base0E: #{{base0E}};
--base0F: #{{base0F}};
}

View File

@@ -0,0 +1,45 @@
# Base16 {{scheme-name}} - kitty color config
# Scheme by {{scheme-author}}
visual_bell_color #{{darken base00 "5"}}
background #{{base00}}
foreground #{{base05}}
selection_background #{{base05}}
selection_foreground #{{base00}}
url_color #{{base0D}}
cursor #{{base0D}}
cursor_text_color #{{base00}}
active_border_color #{{base03}}
inactive_border_color #{{base01}}
active_tab_background #{{base00}}
active_tab_foreground #{{base05}}
inactive_tab_background #{{base01}}
inactive_tab_foreground #{{base04}}
# Normal
color0 #{{base00}}
color1 #{{base08}}
color2 #{{base0B}}
color3 #{{base0A}}
color4 #{{base0D}}
color5 #{{base0E}}
color6 #{{base0C}}
color7 #{{base05}}
# Bright (same as Normal except 8/15)
color8 #{{base03}}
color9 #{{base08}}
color10 #{{base0B}}
color11 #{{base0A}}
color12 #{{base0D}}
color13 #{{base0E}}
color14 #{{base0C}}
color15 #{{base07}}
# Other (like base16-shell)
color16 #{{base09}}
color17 #{{base0F}}
color18 #{{base01}}
color19 #{{base02}}
color20 #{{base04}}
color21 #{{base06}}

View File

@@ -0,0 +1,121 @@
/* Base16 {{scheme-name}}
* Scheme author: {{scheme-author}}
* Obsidian theme author: acidghost (https://github.com/acidghost)
*/
:root {
--font-monospace: 'Hack Nerd Font', 'Source Code Pro', monospace;
}
.theme-dark {
--background-primary: #{{base00}};
--background-primary-alt: #{{base01}};
--background-secondary: #{{base00}};
--background-secondary-alt: #{{base01}};
--background-modifier-border: #{{base03}};
--background-modifier-form-field: rgba(0, 0, 0, 0.3);
--background-modifier-form-field-highlighted: rgba(0, 0, 0, 0.22);
--background-modifier-box-shadow: rgba(0, 0, 0, 0.3);
--background-modifier-success: #{{base0B}};
--background-modifier-error: #{{base08}};
--background-modifier-error-rgb: {{rgb_r base08}}, {{rgb_g base08}}, {{rgb_b base08}};
/* --background-modifier-error-hover: #470000; */
--background-modifier-cover: rgba(0, 0, 0, 0.8);
--text-accent: #{{base0F}};
--text-accent-hover: #{{base0D}};
--text-normal: #{{base07}};
--text-muted: #{{base05}};
--text-muted-rgb: {{rgb_r base05}}, {{rgb_g base05}}, {{rgb_b base05}};
--text-faint: #{{base03}};
--text-error: #{{base0E}};
--text-error-hover: #{{base08}};
--text-highlight-bg: rgba(255, 255, 0, 0.4);
--text-highlight-bg-active: rgba(255, 128, 0, 0.4);
--text-selection: rgba(23, 48, 77, 0.99);
--text-on-accent: #dcddde;
--interactive-normal: #2a2a2a;
--interactive-hover: #303030;
--interactive-accent: #{{base0F}};
--interactive-accent-rgb: {{rgb_r base0F}}, {{rgb_g base0F}}, {{rgb_b base0F}};
--interactive-accent-hover: #{{base0E}};
--interactive-success: #197300;
--scrollbar-active-thumb-bg: rgba(255, 255, 255, 0.1);
--scrollbar-bg: rgba(255, 255, 255, 0.05);
--scrollbar-thumb-bg: rgba(255, 255, 255, 0.1);
--highlight-mix-blend-mode: lighten;
}
.CodeMirror-lines {
font-family: var(--font-monospace);
}
.graph-view.color-fill,
.graph-view.color-circle,
.graph-view.color-line,
.graph-view.color-text,
.graph-view.color-arrow {
color: var(--text-accent);
}
.graph-view.color-fill-highlight,
.graph-view.color-line-highlight {
color: var(--text-accent-hover);
}
.graph-view.color-fill-unresolved {
color: #600;
}
.workspace-tabs .workspace-leaf {
background-color: var(--background-primary);
}
.workspace-tab-header-container {
background-color: var(--background-primary);
}
.workspace-tab-header.is-active {
background-color: var(--background-primary);
color: var(--text-accent);
}
.workspace-tab-header.is-after-active .workspace-tab-header-inner,
.workspace-tab-header.is-before-active .workspace-tab-header-inner {
background-color: var(--background-primary);
}
.workspace-tab-container-before.is-before-active .workspace-tab-header-inner,
.workspace-tab-container-after.is-after-active .workspace-tab-header-inner,
.workspace-tab-header.is-before-active .workspace-tab-header-inner,
.workspace-tab-header.is-after-active .workspace-tab-header-inner {
background-color: var(--background-primary);
}
.workspace-split.mod-root > .workspace-leaf:last-of-type .workspace-leaf-content {
border-top-right-radius: 0;
}
.workspace-split.mod-root > .workspace-leaf:first-of-type .workspace-leaf-content {
border-top-left-radius: 0;
}
.workspace-split.mod-left-split .workspace-tabs .workspace-leaf {
border-top-left-radius: 0;
}
.workspace-split.mod-right-split .workspace-tabs .workspace-leaf {
border-top-right-radius: 0;
}
.suggestion-item.is-selected {
background-color: var(--background-primary-alt);
}
.markdown-preview-view.is-readable-line-width .markdown-preview-sizer {
max-width: 900px;
}
.markdown-source-view.is-readable-line-width .CodeMirror,
.markdown-source-view.mod-cm6.is-line-wrap.is-readable-line-width .cm-content,
.markdown-source-view.mod-cm6.is-line-wrap.is-readable-line-width .cm-line:not(.HyperMD-table-row),
.markdown-source-view.mod-cm6.is-readable-line-width:not(.is-rtl) .cm-contentContainer {
max-width: 900px;
}

View File

@@ -0,0 +1,18 @@
BG={{base05}}
FG={{base00}}
HDR_BG={{base04}}
HDR_FG={{base01}}
SEL_BG={{base00}}
SEL_FG={{base0D}}
TXT_BG={{base06}}
TXT_FG={{base01}}
BTN_BG={{base03}}
BTN_FG={{base07}}
HDR_BTN_BG={{base05}}
HDR_BTN_FG={{base01}}
WM_BORDER_FOCUS={{base0D}}
WM_BORDER_UNFOCUS={{base04}}
GRADIENT=0.0
ROUNDNESS=2
SPACING=3

View File

@@ -0,0 +1,18 @@
BG={{base00}}
FG={{base05}}
HDR_BG={{base01}}
HDR_FG={{base04}}
SEL_BG={{base0D}}
SEL_FG={{base00}}
TXT_BG={{base01}}
TXT_FG={{base06}}
BTN_BG={{base02}}
BTN_FG={{base07}}
HDR_BTN_BG={{base05}}
HDR_BTN_FG={{base01}}
WM_BORDER_FOCUS={{base0D}}
WM_BORDER_UNFOCUS={{base04}}
GRADIENT=0.0
ROUNDNESS=2
SPACING=3

View File

@@ -0,0 +1,95 @@
/*******************************************************************************
* ROFI SQUARED THEME USING THE NORD PALETTE
* User : LR-Tech
* Theme Repo : https://github.com/lr-tech/rofi-themes-collection
*******************************************************************************/
* {
font: "FiraCode Nerd Font Medium 12";
bg0: #{{base00}};
bg1: #{{base01}};
fg0: #{{base07}};
accent-color: #{{base0C}};
urgent-color: #{{base08}};
background-color: transparent;
text-color: @fg0;
margin: 0;
padding: 0;
spacing: 0;
}
window {
location: center;
width: 480;
background-color: @bg0;
}
inputbar {
spacing: 8px;
padding: 8px;
background-color: @bg1;
}
prompt, entry, element-icon, element-text {
vertical-align: 0.5;
}
prompt {
text-color: @accent-color;
}
textbox {
padding: 8px;
background-color: @bg1;
}
listview {
padding: 4px 0;
lines: 8;
columns: 1;
fixed-height: false;
}
element {
padding: 8px;
spacing: 8px;
}
element normal normal {
text-color: @fg0;
}
element normal urgent {
text-color: @urgent-color;
}
element normal active {
text-color: @accent-color;
}
element selected {
text-color: @bg0;
}
element selected normal, element selected active {
background-color: @accent-color;
}
element selected urgent {
background-color: @urgent-color;
}
element-icon {
size: 0.8em;
}
element-text {
text-color: inherit;
}

View File

@@ -0,0 +1,8 @@
ColorForeground=#{{base05}}
ColorBackground=#{{base00}}
ColorCursor=#{{base0C}}
ColorSelection=#{{base00}}
ColorBold=#{{base05}}
ColorBoldUseDefault=FALSE
ColorPalette=#{{base00}};#{{base08}};#{{base0B}};#{{base0A}};#{{base0D}};#{{base0E}};#{{base0C}};#{{base05}};#{{base03}};#{{base08}};#{{base0B}};#{{base0A}};#{{base0D}};#{{base0E}};#{{base0C}};#{{base07}}
TabActivityColor=#{{base0A}}

View File

@@ -1,13 +1,24 @@
# Cookbook
This document is a collection of ways to use shchemes. While many of these examples are useful for creating scripts to [automatically change your whole desktop's color scheme](#change-scheme-script), many of the examples given are meant to be ran in the terminal, to grow a greater familiarity with the techniques used.
## Qutebrowser
## GTK
### Oomox
Shchemes can generate colors for [oomox-gtk-theme](https://github.com/themix-project/oomox-gtk-theme), allowing your theme to spread to most of your desktop, providing it uses the GTK toolkit. `oomox-gtk-theme` includes a script we can call with the theme Shchemes generates to install a GTK theme with your colors.
### Remotely reloading your Qutebrowser configuration
Qutebrowser can be remotely reloaded by sending it a SIGHUP signal.
```sh
pkill -HUP qutebrowser
"./change_color.sh" -o shchemes <(shchemes create_theme oomox-gtk -s=base16:horizon-terminal-dark)
```
Note on older versions (<=3.1.0) this will simply kill Qutebrowser.
This will install the theme to `~/.themes/shchemes`.
### Reload XFCE theme
If you're generating an Oomox theme, as detailed above, you may want some way of automatically setting or refreshing the GTK theme XFCE uses.
```sh
xfconf-query -c xsettings -p /Net/ThemeName -r
xfconf-query -c xsettings -p /Net/ThemeName -s shchemes
```
You may need to replace `shchemes` with the name of your theme in `~/.themes`
## ImageMagick
Shchemes can create [ImageMagick pixel enumeration files](https://imagemagick.org/Usage/files/#txt), with a vertical strip of all the colors in the scheme. This is optimal for getting the color data into an image, or simply displaying the palette.
@@ -49,3 +60,52 @@ You'll need to call it from your bspwmrc
```sh
"$(dirname $0)/colors"
```
## Reloading configs
### Remotely reloading your Qutebrowser configuration
Qutebrowser can be remotely reloaded by sending it a HUP signal.
```sh
pkill -HUP qutebrowser
```
Note on older versions (<=3.1.0) this will simply kill Qutebrowser.
### Remotely reloading your Kitty configuration
Kitty will reload it's configuration on a USR1 signal.
```sh
pkill -USR1 kitty
```
## Creating an script to automatically theme your whole desktop {#change-scheme-script}
This is the use case that shchemes was designed to fulfill.
### `SCHEME` environment variable
To avoid having to use `-s` or `--scheme` in every command of your script, shchemes will also read a `SCHEME` environment variable if those flags aren't set.
This is a useful pattern to put at the top of a script.
```bash
export SCHEME=$1
```
### Automatically installing a `tinted-theming` scheme
This snippet will automatically install your scheme from the [tinted-theming collection](https://github.com/tinted-theming/schemes) and exit if it can't be found.
```sh
if ! shchemes install_tinted_scheme ; then
exit 1
fi
```
### `.profile` injection
Sometimes you have other scripts that need to know what theme is currently applied on your system. One way to do this is to set the `SCHEME` environment variable in your `.profile`.
```sh
echo '#START SHCHEMES BLOCK : printf "SCHEME=\"%s\"\n" "$SCHEME"' > ~/.profile
```
And in your script:
```sh
shchemes inject "$HOME/.profile"
```
> [!CAUTION]
> Shchemes injection is literally one Awk script. While lots of care has been taken, we are not liable for it mangling your configuration files, and we give no guarantees. It is recommended you backup your configs, preferably in something with version control in case you don't realise something's gone wrong until later.

View File

@@ -20,6 +20,41 @@ rgb_b() {
printf "$((0x${MO_FUNCTION_ARGS[0]:4:4}))"
}
rgb() {
rgb_r; printf " "
rgb_g; printf " "
rgb_b; printf " "
}
clamp() {
if [[ $1 -lt 0 ]]; then
printf "0"
else
if [[ $1 -gt 255 ]]; then
printf "255"
else
printf "%s" "$1"
fi
fi
}
lighten() {
mod="${MO_FUNCTION_ARGS[1]}"
parts=("$(rgb_r)" "$(rgb_g)" "$(rgb_b)")
vars=""
for part in "${parts[@]}"; do
let var=$part+$mod
vars=$vars"$(clamp "$var") "
done
printf "%02x%02x%02x" $vars
}
darken() {
MO_FUNCTION_ARGS[1]="-${MO_FUNCTION_ARGS[1]}"
lighten
}
set -a # All variables after this will be exported
source $SCHEME
mo "$TEMPLATE"

View File

@@ -130,17 +130,18 @@ inject() {
parse_scheme
check_scheme_path
parse_comment_pattern
tmp=$(mktemp)
if [ "$comment_start" == "" ]; then
comment_start="#"
fi
awk -i inplace \
-v blockstart="${comment_start}START SHCHEMES BLOCK" \
awk -v blockstart="${comment_start}START SHCHEMES BLOCK" \
-v blockend="${comment_start}END SHCHEMES BLOCK" \
-v commentend="$comment_end" \
-v scheme="$scheme" \
-v shchemes="$shchemes_path" \
-v sq="'" \
-v nl="\n" \
-F ":" '
!inblock { print }
inblock {
@@ -153,39 +154,54 @@ $1 ~ blockstart {
system("/usr/bin/env bash -c " sq "SCHEME=\"" scheme "\";" command sq);
next
}
$1 ~ blockend {
$1 == blockend && inblock {
inblock = 0;
print;
next
print nl blockend commentend;
next;
}
ENDFILE {
if(inblock) {
print blockend commentend;
for(i=1;i<=bi;i++) {
print lines[i];
}
}
ENDFILE {
if(inblock) {
print nl blockend commentend;
for(i=1;i<=bi;i++) {
print lines[i];
}
}
}
' "$path"
' "$path" > "$tmp" && mv "$tmp" "$path"
}
convert_tinted_template() {
# TODO: multiple format support, check that line actually has multiple fields
merge() {
path=$1
sed -r \
-e 's/\{\{base([0-9A-F]+)-hex\}\}/{{base\1}}/' \
-e 's/\{\{base([0-9A-F]+)-rgb-r\}\}/{{rgb_r base\1}}/' \
-e 's/\{\{base([0-9A-F]+)-rgb-g\}\}/{{rgb_g base\1}}/' \
-e 's/\{\{base([0-9A-F]+)-rgb-b\}\}/{{rgb_b base\1}}/' "$path"
tmp=$(mktemp)
awk -F "=" '
FILENAME == "-" {
a[$1] = $2
next
}
a[$1] {
print $1 "=" a[$1]
next
}
{ print }
' - "$path" > "$tmp" && mv "$tmp" "$path"
}
convert_tinted_scheme() {
path=$1
tmp=$(mktemp)
awk -i inplace -F ' *: *' '
awk -F ' *: *' '
/^#/ { print }
$1 ~ "palette" { p = 1; next }
p && /^ +/ { gsub(/ /, "", $1); print $1 "=" $2 }
' "$path"
p && /^ +/ {
gsub(/ /, "", $1);
gsub(/^"#/, "", $2);
gsub(/"$/, "", $2);
print $1 "=\"" $2 "\""
}
' "$path" > "$tmp" && mv -f "$tmp" "$path"
}
install_tinted_scheme() {
@@ -216,11 +232,23 @@ install_tinted_scheme() {
echo "Installed ${scheme}"
}
convert_tinted_template() {
path=$1
sed -r \
-e 's/\{\{base([0-9A-F]+)-hex\}\}/{{base\1}}/' \
-e 's/\{\{base([0-9A-F]+)-rgb-r\}\}/{{rgb_r base\1}}/' \
-e 's/\{\{base([0-9A-F]+)-rgb-g\}\}/{{rgb_g base\1}}/' \
-e 's/\{\{base([0-9A-F]+)-rgb-b\}\}/{{rgb_b base\1}}/' "$path"
}
install_tinted_template() {
url=$1
target=$2
tmp=$(mktemp)
curl "$url" | convert_tinted_template > "${shchemes_dir}/base16/templates/${target}.mustache"
curl "$url" > "$tmp"
convert_tinted_template "$tmp" > "${shchemes_dir}/base16/templates/${target}.mustache"
rm "$tmp"
}
manual() {
@@ -237,6 +265,10 @@ if [ "$method" != "" ]; then
inject "${args[1]}" "${args[2]}"
;;
merge)
merge "${args[1]}" "${args[2]}"
;;
convert_tinted_template)
convert_tinted_template "${args[1]}"
;;