Compare commits

...
10 Commits
Author SHA1 Message Date
Lain 9d7c5847b2 make it better 2022-03-28 17:03:00 +03:00
Lain d82082366f make it better 2022-03-28 17:02:21 +03:00
Lain dbce46a44a wallpaper fixed 2022-03-28 16:37:55 +03:00
Lain f616a4630f wallpaper path fixed 2022-03-28 16:28:17 +03:00
Lain 1d33df2e1a wallpaper path sanitized 2022-03-28 16:24:40 +03:00
Lain ce6a9a7cd3 wallpaper path sanitized 2022-03-28 16:23:37 +03:00
Lain c08f19b5fd wallpaper fix 2022-03-28 16:20:23 +03:00
Lain d3d773aa3e update README 2022-03-25 14:37:06 +03:00
Lain 53e91ca4cf small note 2022-03-25 12:49:16 +03:00
Lain f8a7091ef4 make it more clear 2022-03-25 12:30:01 +03:00
2 changed files with 76 additions and 35 deletions
+16 -1
View File
@@ -1,6 +1,21 @@
# Chromium pywal theme generator # 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
![Screenshot](./Screenshots/screenshot.png) ![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 "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. 😁
+48 -22
View File
@@ -1,43 +1,64 @@
#!/bin/bash #!/bin/bash
. ~/.cache/wal/colors.sh . ~/.cache/wal/colors.sh # import colors from pywal
# Your path for extensions folder here THEME_NAME="Pywal"
THEME_PATH="$HOME/Chromium Extensions/pywaltheme"
DIR=$(dirname "${BASH_SOURCE[0]}")
THEME_DIR="$DIR/$THEME_NAME"
# Converts hex colors into rgb joined with comma
# #fff -> 255, 255, 255
hexToRgb() { hexToRgb() {
# Remove '#' character from hex color #fff -> fff # Remove '#' character from hex color #fff -> fff
plain=${1#*#} plain=${1#*#}
printf "%d, %d, %d" 0x${plain:0:2} 0x${plain:2:2} 0x${plain:4:2} printf "%d, %d, %d" 0x${plain:0:2} 0x${plain:2:2} 0x${plain:4:2}
} }
if [ ! -d "$THEME_PATH/images" ]; then prepare() {
mkdir "$THEME_PATH/images" if [ -d $THEME_DIR ]; then
rm -rf $THEME_DIR
fi fi
cp $wallpaper "$THEME_PATH/images/theme_ntp_background_norepeat.png" mkdir $THEME_DIR
mkdir "$THEME_DIR/images"
cat > "$THEME_PATH/manifest.json" << EOF # Copy wallpaper so it can be used in theme
background_image="images/theme_ntp_background_norepeat.png"
cp "$wallpaper" "$THEME_DIR/$background_image"
}
background=$(hexToRgb $background)
foreground=$(hexToRgb $foreground)
accent=$(hexToRgb $color11)
secondary=$(hexToRgb $color8)
generate() {
# Theme template
cat > "$THEME_DIR/manifest.json" << EOF
{ {
"manifest_version": 3, "manifest_version": 3,
"version": "1.0", "version": "1.0",
"name": "pywal theme", "name": "$THEME_NAME Theme",
"images": {
"theme_ntp_background" : "images/theme_ntp_background_norepeat.png"
},
"theme": { "theme": {
"images": {
"theme_ntp_background" : "$background_image"
},
"colors": { "colors": {
"frame": [$(hexToRgb $background)], "frame": [$background],
"frame_inactive": [$(hexToRgb $background)], "frame_inactive": [$background],
"toolbar": [$(hexToRgb $color11)], "toolbar": [$accent],
"ntp_text": [$(hexToRgb $foreground)], "ntp_text": [$foreground],
"ntp_link": [$(hexToRgb $color11)], "ntp_link": [$accent],
"ntp_section": [$(hexToRgb $color8)], "ntp_section": [$secondary],
"button_background": [$(hexToRgb $foreground)], "button_background": [$foreground],
"toolbar_button_icon": [$(hexToRgb $foreground)], "toolbar_button_icon": [$foreground],
"toolbar_text": [$(hexToRgb $foreground)], "toolbar_text": [$foreground],
"omnibox_background": [$(hexToRgb $background)], "omnibox_background": [$background],
"omnibox_text": [$(hexToRgb $foreground)] "omnibox_text": [$foreground]
}, },
"properties": { "properties": {
"ntp_background_alignment": "bottom" "ntp_background_alignment": "bottom"
@@ -45,3 +66,8 @@ cat > "$THEME_PATH/manifest.json" << EOF
} }
} }
EOF EOF
}
prepare
generate
echo "Pywal Chrome theme generated at $THEME_DIR"