dotfiles
Clone
https://git.tahinli.com/Tahinli/dotfiles.git
0 watching0 forksShellGPL-3.0334.8 KiBb1320e9Tahinli16 days ago105 commits
| 1 | #!/bin/bash |
| 2 | # Post-process wallust-generated theme files: |
| 3 | # - GTK 3/4: resolve mix(#hex, #hex, ratio) to pre-computed hex values |
| 4 | # - QT 5/6: convert colors and compute mixed surface colors |
| 5 | |
| 6 | # Configure ~/.gtkrc-2.0: |
| 7 | # - Force gtk-theme-name to Raleigh (minimal, no pixmap engine, lets our colors through) |
| 8 | # - Ensure our include is parsed LAST so our styles win |
| 9 | # |
| 10 | # nwg-look owns this file when it is installed, but GTK2 will not read our |
| 11 | # generated .mine without the include, and on a fresh machine (or without |
| 12 | # nwg-look) the file does not exist at all — so create it instead of bailing out. |
| 13 | GTKRC="/.gtkrc-2.0" |
| 14 | MINE_INC="include \"/.gtkrc-2.0.mine\"" |
| 15 | [ || |
| 16 | || |
| 17 | | |
| 18 | |
| 19 | |
| 20 | |
| 21 | # Convert hex colors to KDE's R,G,B integer format in kdeglobals |
| 22 | KDEGLOBALS="/.config/kdeglobals" |
| 23 | if [; then |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | fi |
| 47 | |
| 48 | # Resolve mix() in GTK CSS / gtkrc files, and in the Qt color schemes. |
| 49 | # The Qt confs must be handled here, before the #RRGGBB -> #ffRRGGBB pass below, |
| 50 | # because the mix() regex only matches 6-digit hex. |
| 51 | for; do |
| 52 | [ || continue |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | done |
| 72 | |
| 73 | for; do |
| 74 | [ || continue |
| 75 | |
| 76 | # Convert #RRGGBB to #ffRRGGBB (strip any existing ff first to avoid double-prefix) |
| 77 | |
| 78 | |
| 79 | # Extract foreground (pos 0), color1 (pos 1), background (pos 4), color4 (pos 12) |
| 80 | IFS=',' |
| 81 | FG="" |
| 82 | C1="" |
| 83 | BG="" |
| 84 | C4="" |
| 85 | |
| 86 | FG="" |
| 87 | C1="" |
| 88 | BG="" |
| 89 | C4="" |
| 90 | |
| 91 | # Compute mixed colors: |
| 92 | # surface = mix(bg, c1, 0.35) - window/base |
| 93 | # button = mix(bg, c1, 0.45) - button bg |
| 94 | # accent = mix(c4, fg, 0.3) - lightened selection |
| 95 | COMPUTED= |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | MIXED= |
| 106 | MIXED_BTN= |
| 107 | MIXED_ACCENT= |
| 108 | |
| 109 | # Replace surface roles: Base(9), Window(10), AlternateBase(16), ToolTipBase(18) with MIXED |
| 110 | # NOTE: role order is QPalette::ColorRole — index 17 is NoRole, ToolTipBase is 18. |
| 111 | # Replace Button(1) with MIXED_BTN |
| 112 | # Replace Highlight(12) and pos 20 with MIXED_ACCENT |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | done |