Compare commits
10
Commits
ad01ea2469
...
9d7c5847b2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d7c5847b2 | ||
|
|
d82082366f | ||
|
|
dbce46a44a | ||
|
|
f616a4630f | ||
|
|
1d33df2e1a | ||
|
|
ce6a9a7cd3 | ||
|
|
c08f19b5fd | ||
|
|
d3d773aa3e | ||
|
|
53e91ca4cf | ||
|
|
f8a7091ef4 |
@@ -1,6 +1,21 @@
|
||||
# Chromium pywal theme generator
|
||||
|
||||
Generates a chromium theme by using colors generated by [pywal](https://github.com/dylanaraps/pywal)
|
||||
Generates [pywal](https://github.com/dylanaraps/pywal) theme for Chromium
|
||||
|
||||

|
||||
|
||||
## Usage
|
||||
|
||||
1. Run script `./generate-theme.sh`
|
||||
2. Open chromium
|
||||
3. Go to `chrome://extensions`
|
||||
4. Turn on "Developer Mode" in the top right corner
|
||||
5. Press "Load unpacked"
|
||||
6. Select "Pywal" (by default) in the same folder with the script
|
||||
7. ???
|
||||
8. PROFIT!
|
||||
|
||||
However, you need to run this script and restart chromium each time you change pywal colors (or reload extension manually, since there is no way to do it automatically).
|
||||
So, make an alias or something like that.
|
||||
But you don't need to repeat the steps above, just run the script and that's it, chromium will update theme colors automatically. 😁
|
||||
|
||||
|
||||
+60
-34
@@ -1,47 +1,73 @@
|
||||
#!/bin/bash
|
||||
|
||||
. ~/.cache/wal/colors.sh
|
||||
. ~/.cache/wal/colors.sh # import colors from pywal
|
||||
|
||||
# Your path for extensions folder here
|
||||
THEME_PATH="$HOME/Chromium Extensions/pywaltheme"
|
||||
THEME_NAME="Pywal"
|
||||
|
||||
|
||||
DIR=$(dirname "${BASH_SOURCE[0]}")
|
||||
THEME_DIR="$DIR/$THEME_NAME"
|
||||
|
||||
# Converts hex colors into rgb joined with comma
|
||||
# #fff -> 255, 255, 255
|
||||
hexToRgb() {
|
||||
# Remove '#' character from hex color #fff -> fff
|
||||
plain=${1#*#}
|
||||
printf "%d, %d, %d" 0x${plain:0:2} 0x${plain:2:2} 0x${plain:4:2}
|
||||
}
|
||||
|
||||
if [ ! -d "$THEME_PATH/images" ]; then
|
||||
mkdir "$THEME_PATH/images"
|
||||
fi
|
||||
prepare() {
|
||||
if [ -d $THEME_DIR ]; then
|
||||
rm -rf $THEME_DIR
|
||||
fi
|
||||
|
||||
mkdir $THEME_DIR
|
||||
mkdir "$THEME_DIR/images"
|
||||
|
||||
# Copy wallpaper so it can be used in theme
|
||||
background_image="images/theme_ntp_background_norepeat.png"
|
||||
cp "$wallpaper" "$THEME_DIR/$background_image"
|
||||
|
||||
cp $wallpaper "$THEME_PATH/images/theme_ntp_background_norepeat.png"
|
||||
|
||||
cat > "$THEME_PATH/manifest.json" << EOF
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"version": "1.0",
|
||||
"name": "pywal theme",
|
||||
"images": {
|
||||
"theme_ntp_background" : "images/theme_ntp_background_norepeat.png"
|
||||
},
|
||||
"theme": {
|
||||
"colors": {
|
||||
"frame": [$(hexToRgb $background)],
|
||||
"frame_inactive": [$(hexToRgb $background)],
|
||||
"toolbar": [$(hexToRgb $color11)],
|
||||
"ntp_text": [$(hexToRgb $foreground)],
|
||||
"ntp_link": [$(hexToRgb $color11)],
|
||||
"ntp_section": [$(hexToRgb $color8)],
|
||||
"button_background": [$(hexToRgb $foreground)],
|
||||
"toolbar_button_icon": [$(hexToRgb $foreground)],
|
||||
"toolbar_text": [$(hexToRgb $foreground)],
|
||||
"omnibox_background": [$(hexToRgb $background)],
|
||||
"omnibox_text": [$(hexToRgb $foreground)]
|
||||
},
|
||||
"properties": {
|
||||
"ntp_background_alignment": "bottom"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
background=$(hexToRgb $background)
|
||||
foreground=$(hexToRgb $foreground)
|
||||
accent=$(hexToRgb $color11)
|
||||
secondary=$(hexToRgb $color8)
|
||||
|
||||
generate() {
|
||||
# Theme template
|
||||
cat > "$THEME_DIR/manifest.json" << EOF
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"version": "1.0",
|
||||
"name": "$THEME_NAME Theme",
|
||||
"theme": {
|
||||
"images": {
|
||||
"theme_ntp_background" : "$background_image"
|
||||
},
|
||||
"colors": {
|
||||
"frame": [$background],
|
||||
"frame_inactive": [$background],
|
||||
"toolbar": [$accent],
|
||||
"ntp_text": [$foreground],
|
||||
"ntp_link": [$accent],
|
||||
"ntp_section": [$secondary],
|
||||
"button_background": [$foreground],
|
||||
"toolbar_button_icon": [$foreground],
|
||||
"toolbar_text": [$foreground],
|
||||
"omnibox_background": [$background],
|
||||
"omnibox_text": [$foreground]
|
||||
},
|
||||
"properties": {
|
||||
"ntp_background_alignment": "bottom"
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
prepare
|
||||
generate
|
||||
echo "Pywal Chrome theme generated at $THEME_DIR"
|
||||
|
||||
Reference in New Issue
Block a user