1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

Theme consistency overhaul:

- Add surface shift option, start from surface by default (previously
  was surfaceContainer). Old colors can be attained by changing it back
to "container" in theme colors
- Remove borders on surface elements, mostly
- Fix popup distances
- Use surfaceContainer/sch by default on widgets
This commit is contained in:
bbedward
2025-09-25 12:46:37 -04:00
parent 7ccd2d9418
commit a4a59fd586
73 changed files with 573 additions and 487 deletions

View File

@@ -47,21 +47,25 @@ key_of() {
local mode=$(echo "$json" | sed 's/.*"mode": *"\([^"]*\)".*/\1/')
local icon=$(echo "$json" | sed 's/.*"iconTheme": *"\([^"]*\)".*/\1/')
local matugen_type=$(echo "$json" | sed 's/.*"matugenType": *"\([^"]*\)".*/\1/')
local surface_base=$(echo "$json" | sed 's/.*"surfaceBase": *"\([^"]*\)".*/\1/')
[[ -z "$icon" ]] && icon="System Default"
[[ -z "$matugen_type" ]] && matugen_type="scheme-tonal-spot"
echo "${kind}|${value}|${mode}|${icon}|${matugen_type}" | sha256sum | cut -d' ' -f1
[[ -z "$surface_base" ]] && surface_base="sc"
echo "${kind}|${value}|${mode}|${icon}|${matugen_type}|${surface_base}" | sha256sum | cut -d' ' -f1
}
build_once() {
local json="$1"
local kind value mode icon matugen_type
local kind value mode icon matugen_type surface_base
kind=$(echo "$json" | sed 's/.*"kind": *"\([^"]*\)".*/\1/')
value=$(echo "$json" | sed 's/.*"value": *"\([^"]*\)".*/\1/')
mode=$(echo "$json" | sed 's/.*"mode": *"\([^"]*\)".*/\1/')
icon=$(echo "$json" | sed 's/.*"iconTheme": *"\([^"]*\)".*/\1/')
matugen_type=$(echo "$json" | sed 's/.*"matugenType": *"\([^"]*\)".*/\1/')
surface_base=$(echo "$json" | sed 's/.*"surfaceBase": *"\([^"]*\)".*/\1/')
[[ -z "$icon" ]] && icon="System Default"
[[ -z "$matugen_type" ]] && matugen_type="scheme-tonal-spot"
[[ -z "$surface_base" ]] && surface_base="sc"
CONFIG_DIR="${CONFIG_DIR:-$HOME/.config}"
@@ -106,6 +110,34 @@ build_once() {
sed -i "/\[templates\.gtk3\]/,/^$/ s|input_path = './matugen/templates/gtk-colors.css'|input_path = '$COLLOID_TEMPLATE'|" "$TMP_CFG"
sed -i "s|input_path = './matugen/templates/|input_path = '$SHELL_DIR/matugen/templates/|g" "$TMP_CFG"
# Handle surface shifting if needed
if [[ "$surface_base" == "s" ]]; then
TMP_TEMPLATES_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_TEMPLATES_DIR"' RETURN
# Create shifted versions of templates
for template in "$SHELL_DIR/matugen/templates"/*.{css,conf,json,kdl,colors}; do
[[ -f "$template" ]] || continue
template_name="$(basename "$template")"
shifted_template="$TMP_TEMPLATES_DIR/$template_name"
# Apply surface shifting transformations
sed -e 's/{{colors\.surface\.default\.hex}}/{{colors.background.default.hex}}/g' \
-e 's/{{colors\.surface_container\.default\.hex}}/{{colors.surface.default.hex}}/g' \
-e 's/{{colors\.surface_container_high\.default\.hex}}/{{colors.surface_container.default.hex}}/g' \
-e 's/{{colors\.surface_container_highest\.default\.hex}}/{{colors.surface_container_high.default.hex}}/g' \
"$template" > "$shifted_template"
done
# Update config to use shifted templates
sed -i "s|input_path = '$SHELL_DIR/matugen/templates/|input_path = '$TMP_TEMPLATES_DIR/|g" "$TMP_CFG"
# Handle the special colloid template path
if [[ -f "$TMP_TEMPLATES_DIR/gtk3-colors.css" ]]; then
sed -i "/\[templates\.gtk3\]/,/^$/ s|input_path = '$COLLOID_TEMPLATE'|input_path = '$TMP_TEMPLATES_DIR/gtk3-colors.css'|" "$TMP_CFG"
fi
fi
pushd "$SHELL_DIR" >/dev/null
MAT_MODE=(-m "$mode")
MAT_TYPE=(-t "$matugen_type")
@@ -129,21 +161,27 @@ build_once() {
echo "[config]" > "$TMP_CONTENT_CFG"
echo "" >> "$TMP_CONTENT_CFG"
# Use shifted templates for content config if surface_base is "s"
CONTENT_TEMPLATES_PATH="$SHELL_DIR/matugen/templates/"
if [[ "$surface_base" == "s" && -n "${TMP_TEMPLATES_DIR:-}" ]]; then
CONTENT_TEMPLATES_PATH="$TMP_TEMPLATES_DIR/"
fi
if command -v ghostty >/dev/null 2>&1; then
cat "$SHELL_DIR/matugen/configs/ghostty.toml" >> "$TMP_CONTENT_CFG"
sed -i "s|input_path = './matugen/templates/|input_path = '$SHELL_DIR/matugen/templates/|g" "$TMP_CONTENT_CFG"
sed -i "s|input_path = './matugen/templates/|input_path = '${CONTENT_TEMPLATES_PATH}|g" "$TMP_CONTENT_CFG"
echo "" >> "$TMP_CONTENT_CFG"
fi
if command -v kitty >/dev/null 2>&1; then
cat "$SHELL_DIR/matugen/configs/kitty.toml" >> "$TMP_CONTENT_CFG"
sed -i "s|input_path = './matugen/templates/|input_path = '$SHELL_DIR/matugen/templates/|g" "$TMP_CONTENT_CFG"
sed -i "s|input_path = './matugen/templates/|input_path = '${CONTENT_TEMPLATES_PATH}|g" "$TMP_CONTENT_CFG"
echo "" >> "$TMP_CONTENT_CFG"
fi
if command -v dgop >/dev/null 2>&1; then
cat "$SHELL_DIR/matugen/configs/dgop.toml" >> "$TMP_CONTENT_CFG"
sed -i "s|input_path = './matugen/templates/|input_path = '$SHELL_DIR/matugen/templates/|g" "$TMP_CONTENT_CFG"
sed -i "s|input_path = './matugen/templates/|input_path = '${CONTENT_TEMPLATES_PATH}|g" "$TMP_CONTENT_CFG"
echo "" >> "$TMP_CONTENT_CFG"
fi