make it more clear

This commit is contained in:
Lain 2022-03-25 12:30:01 +03:00
parent ad01ea2469
commit f8a7091ef4
2 changed files with 37 additions and 7 deletions

View File

@ -4,3 +4,17 @@ Generates a chromium theme by using colors generated by [pywal](https://github.c
![Screenshot](./Screenshots/screenshot.png)
## 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 "GeneratedTheme" in the same folder with the script
7. ???
8. PROFIT!
However, you need to run this script each time you change pywal colors.
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. 😁

View File

@ -2,26 +2,34 @@
. ~/.cache/wal/colors.sh
# Your path for extensions folder here
THEME_PATH="$HOME/Chromium Extensions/pywaltheme"
DIR=$(dirname "${BASH_SOURCE[0]}")
THEME_DIR="$DIR/GeneratedTheme"
# 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"
if [ ! -d $THEME_DIR ]; then
mkdir $THEME_DIR
fi
cp $wallpaper "$THEME_PATH/images/theme_ntp_background_norepeat.png"
if [ ! -d "$THEME_DIR/images" ]; then
mkdir "$THEME_DIR/images"
fi
cat > "$THEME_PATH/manifest.json" << EOF
# Copy wallpaper so it can be used in theme
cp $wallpaper "$THEME_DIR/images/theme_ntp_background_norepeat.png"
# Theme template
cat > "$THEME_DIR/manifest.json" << EOF
{
"manifest_version": 3,
"version": "1.0",
"name": "pywal theme",
"name": "Pywal Theme",
"images": {
"theme_ntp_background" : "images/theme_ntp_background_norepeat.png"
},
@ -45,3 +53,11 @@ cat > "$THEME_PATH/manifest.json" << EOF
}
}
EOF
# Remove cache so chrome will refresh theme colors on restart
if [ -f "$THEME_DIR/Cached Theme.pak" ]; then
rm "$THEME_DIR/Cached Theme.pak"
fi
echo "Theme generated at $THEME_DIR"