Skip to content

Instantly share code, notes, and snippets.

@addoull
Last active October 6, 2016 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save addoull/dc24644f0e39e109c33fb3bd5323af18 to your computer and use it in GitHub Desktop.
Save addoull/dc24644f0e39e109c33fb3bd5323af18 to your computer and use it in GitHub Desktop.
Material Theme for different terminals
#!/usr/bin/env bash
#
# Material Theme
# --- ----
# Based on
#
# OCEANIC NEXT
# --- ----
# Gnome Terminal color scheme install script
# Based on:
# https://github.com/chriskempson/base16-gnome-terminal/
[[ -z "$PROFILE_NAME" ]] && PROFILE_NAME="Material Theme"
[[ -z "$PROFILE_SLUG" ]] && PROFILE_SLUG="material-theme"
[[ -z "$DCONF" ]] && DCONF=dconf
[[ -z "$UUIDGEN" ]] && UUIDGEN=uuidgen
dset() {
local key="$1"; shift
local val="$1"; shift
if [[ "$type" == "string" ]]; then
val="'$val'"
fi
"$DCONF" write "$PROFILE_KEY/$key" "$val"
}
# because dconf still doesn't have "append"
dlist_append() {
local key="$1"; shift
local val="$1"; shift
local entries="$(
{
"$DCONF" read "$key" | tr -d '[]' | tr , "\n" | fgrep -v "$val"
echo "'$val'"
} | head -c-1 | tr "\n" ,
)"
"$DCONF" write "$key" "[$entries]"
}
# Newest versions of gnome-terminal use dconf
if which "$DCONF" > /dev/null 2>&1; then
[[ -z "$BASE_KEY_NEW" ]] && BASE_KEY_NEW=/org/gnome/terminal/legacy/profiles:
if [[ -n "`$DCONF list $BASE_KEY_NEW/`" ]]; then
if which "$UUIDGEN" > /dev/null 2>&1; then
PROFILE_SLUG=`uuidgen`
fi
if [[ -n "`$DCONF read $BASE_KEY_NEW/default`" ]]; then
DEFAULT_SLUG=`$DCONF read $BASE_KEY_NEW/default | tr -d \'`
else
DEFAULT_SLUG=`$DCONF list $BASE_KEY_NEW/ | grep '^:' | head -n1 | tr -d :/`
fi
DEFAULT_KEY="$BASE_KEY_NEW/:$DEFAULT_SLUG"
PROFILE_KEY="$BASE_KEY_NEW/:$PROFILE_SLUG"
# copy existing settings from default profile
$DCONF dump "$DEFAULT_KEY/" | $DCONF load "$PROFILE_KEY/"
# add new copy to list of profiles
dlist_append $BASE_KEY_NEW/list "$PROFILE_SLUG"
# update profile values with theme options
dset visible-name "'$PROFILE_NAME'"
dset palette "['#263238', '#F77669', '#C3E88D', '#F1E655', '#82B1FF', '#C792EA', '#5C7E8C', '#A7ADBA', '#37474F', '#EC5F67', '#99C794', '#F8E71C', '#82B1FF', '#C792EA', '#80CBC4', '#D8DEE9']"
dset background-color "'#263238'"
dset foreground-color "'#FFFFFF'"
dset bold-color "'#CDD3DE'"
dset bold-color-same-as-fg "true"
dset use-theme-colors "false"
dset use-theme-background "false"
unset PROFILE_NAME
unset PROFILE_SLUG
unset DCONF
unset UUIDGEN
exit 0
fi
fi
# Fallback for Gnome 2 and early Gnome 3
[[ -z "$GCONFTOOL" ]] && GCONFTOOL=gconftool
[[ -z "$BASE_KEY" ]] && BASE_KEY=/apps/gnome-terminal/profiles
PROFILE_KEY="$BASE_KEY/$PROFILE_SLUG"
gset() {
local type="$1"; shift
local key="$1"; shift
local val="$1"; shift
"$GCONFTOOL" --set --type "$type" "$PROFILE_KEY/$key" -- "$val"
}
# Because gconftool doesn't have "append"
glist_append() {
local type="$1"; shift
local key="$1"; shift
local val="$1"; shift
local entries="$(
{
"$GCONFTOOL" --get "$key" | tr -d '[]' | tr , "\n" | fgrep -v "$val"
echo "$val"
} | head -c-1 | tr "\n" ,
)"
"$GCONFTOOL" --set --type list --list-type $type "$key" "[$entries]"
}
# Append profile to the profile list
glist_append string /apps/gnome-terminal/global/profile_list "$PROFILE_SLUG"
gset string visible_name "$PROFILE_NAME"
gset string palette "#263238:#F77669:#C3E88D:#F1E655:#82B1FF:#C792EA:#5C7E8C:#A7ADBA:#37474F:#EC5F67:#99C794:#F8E71C:#82B1FF:#C792EA:#80CBC4:#D8DEE9"
gset string background_color "#263238"
gset string foreground_color "#FFFFFF"
gset string bold_color "#CDD3DE"
gset bool bold_color_same_as_fg "true"
gset bool use_theme_colors "false"
gset bool use_theme_background "false"
unset PROFILE_NAME
unset PROFILE_SLUG
unset DCONF
unset UUIDGEN
#!/bin/bash
# Save this script into set_colors.sh, make this file executable and run it:
#
# $ chmod +x set_colors.sh
# $ ./set_colors.sh
#
# Alternatively copy lines below directly into your shell.
gconftool-2 -s -t string /apps/guake/style/background/color '#262632323838'
gconftool-2 -s -t string /apps/guake/style/font/color '#ffffffffffff'
gconftool-2 -s -t string /apps/guake/style/font/palette '#262632323838:#f7f776766969:#c3c3e8e88d8d:#f1f1e6e65555:#8282b1b1ffff:#c7c79292eaea:#5c5c7e7e8c8c:#cdcdd3d3dede:#373747474f4f:#ecec5f5f6767:#9999c7c79494:#f8f8e7e71c1c:#8282b1b1ffff:#c7c79292eaea:#8080cbcbc4c4:#ffffffffffff'
[global_config]
enabled_plugins = ActivityWatch, TerminalShot, LaunchpadCodeURLHandler, APTURLHandler
homogeneous_tabbar = False
scroll_tabbar = True
tab_position = hidden
title_font = Inconsolata-dz for Powerline Medium 13
title_hide_sizetext = True
title_transmit_bg_color = "#00536e"
title_transmit_fg_color = "#d8d8d8"
title_use_system_font = False
window_state = maximise
[keybindings]
broadcast_group = <Alt>b
broadcast_off = <Alt>x
[layouts]
[[default]]
[[[child1]]]
parent = window0
profile = default
type = Terminal
[[[window0]]]
parent = ""
type = Window
[plugins]
[profiles]
[[default]]
background_color = "#263238"
background_darkness = 0.97
background_image = None
background_type = transparent
cursor_color = "#ffffff"
font = Inconsolata-dz for Powerline Medium 13
foreground_color = "#ffffff"
palette = "#263238:#f77669:#c3e88d:#f1e655:#82b1ff:#c792ea:#5c7e8c:#cdd3de:#37474f:#ec5f67:#99c794:#f8e71c:#82b1ff:#c792ea:#80cbc4:#ffffff"
scrollback_infinite = True
use_system_font = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment