PapirusDevelopmentTeam / papirus-folders

a script that lets you change the colors of folders in Papirus icon theme
https://git.io/papirus-folders
MIT License
600 stars 32 forks source link

Oomox plugin #11

Closed actionless closed 5 years ago

actionless commented 5 years ago

Hi what about having plugin for Oomox?

You can have a look on Numix-Folders plugin as an example: https://github.com/themix-project/oomox/tree/master/plugins/icons_numix

As you can see in code of the plugin itself, it's very primitive, you just specifying path to the script and arguments: https://github.com/themix-project/oomox/blob/master/plugins/icons_numix/oomox_plugin.py

Here how icon plugins are working in Oomox:

2019-01-15--1547511271_897x430_scrot 2019-01-15--1547511198_883x335_scrot 2019-01-15--1547511226_877x357_scrot

SmartFinn commented 5 years ago

Looks that a useful tool for us but I can't understand how to create child themes with custom folder colors (ex. {Papirus,Numix}-Light). Customizing for Papirus only doesn't look a great idea.

SmartFinn commented 5 years ago

I can copy all variants of the icon themes under new names ${OUTPUT_THEME_NAME}-{Dark,Light}, but it requires to remap all symlinks for Papirus-Dark theme. Looks like there no another way to solve it.

actionless commented 5 years ago

i think it would be better to make a dropdown Dark/Light theme and generate only one based on it (like it's done now for choosing Numix folders style)

actionless commented 5 years ago

(mb just use for preview some icon on which it will be noticeable the difference between Light and Dark variant)

SmartFinn commented 5 years ago

Yes, it can work. I try to make the script a bit later.

actionless commented 5 years ago

thanks! let me know if you have any questions

actionless commented 5 years ago

hi, i was playing with the icons now, what do you think about using Dark Stroke (or introducing new color variable) for symbolic icons instead of choosing one of 3 combinations of the Base Theme?

2019-01-20--1547941086_887x277_scrot

actionless commented 5 years ago

2019-01-20--1547941478_883x336_scrot

diff --git a/plugins/icons_papirus/change_color.sh b/plugins/icons_papirus/change_color.sh
index 9846fbc0..80e66629 100755
--- a/plugins/icons_papirus/change_color.sh
+++ b/plugins/icons_papirus/change_color.sh
@@ -97,7 +97,8 @@ trap post_clean_up EXIT SIGHUP SIGINT SIGTERM

 : "${ICONS_COLOR:=$SEL_BG}"
-: "${ICONS_PAPIRUS_THEME:=Papirus}"  # Papirus | Papirus-Dark | Papirus-Light
+#: "${ICONS_PAPIRUS_THEME:=Papirus}"  # Papirus | Papirus-Dark | Papirus-Light
+ICONS_PAPIRUS_THEME=Papirus-Dark
 : "${OUTPUT_THEME_NAME:=oomox-$THEME}"

 output_dir="$HOME/.icons/$OUTPUT_THEME_NAME"
@@ -109,6 +110,7 @@ dark_stroke_fallback="$(darker "$ICONS_COLOR" 56)"
 : "${ICONS_LIGHT_FOLDER:=$light_folder_fallback}"
 : "${ICONS_MEDIUM:=$medium_base_fallback}"
 : "${ICONS_DARK:=$dark_stroke_fallback}"
+: "${ICONS_SYMBOLIC:=$dark_stroke_fallback}"

 echo ":: Copying theme template..."
@@ -119,6 +121,8 @@ if [ "$ICONS_PAPIRUS_THEME" != "Papirus" ]; then
        -printf '%P\n' | while read -r file_path; do
        cp -f "$root/papirus-icon-theme/$ICONS_PAPIRUS_THEME/$file_path" \
            "$tmp_dir/Papirus/$file_path"
+       sed -i'' -e "s/dfdfdf/$ICONS_SYMBOLIC/g" \
+           "$tmp_dir/Papirus/$file_path"
    done
 fi
 echo "== Template was copied to $tmp_dir"
diff --git a/plugins/icons_papirus/icon_previews/system-file-manager.svg.template b/plugins/icons_papirus/icon_previews/system-file-manager.svg.template
index bd15d5fe..b4b05997 100644
--- a/plugins/icons_papirus/icon_previews/system-file-manager.svg.template
+++ b/plugins/icons_papirus/icon_previews/system-file-manager.svg.template
@@ -1,8 +1,3 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" version="1">
- <rect style="opacity:0.2" width="40" height="26" x="4" y="17" rx="2" ry="2"/>
- <path style="fill:#%MEDIUM%" d="M 4,34 C 4,35.108 4.892,36 6,36 H 42 C 43.108,36 44,35.108 44,34 V 12 C 44,10.892 43.108,10 42,10 H 22 V 8 C 22,6.892 21.108,6 20,6 H 6 C 4.892,6 4,6.892 4,8"/>
- <rect style="opacity:0.2" width="40" height="26" x="4" y="15" rx="2" ry="2"/>
- <rect style="fill:#e4e4e4" width="36" height="16" x="6" y="13" rx="2" ry="2"/>
- <rect style="fill:#%LIGHT%" width="40" height="26" x="4" y="16" rx="2" ry="2"/>
- <path style="opacity:0.1;fill:#ffffff" d="M 6,6 C 4.892,6 4,6.892 4,8 V 9 C 4,7.892 4.892,7 6,7 H 20 C 21.108,7 22,7.892 22,9 V 8 C 22,6.892 21.108,6 20,6 Z M 22,10 V 11 H 42 C 43.108,11 44,11.892 44,13 V 12 C 44,10.892 43.108,10 42,10 Z"/>
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
+ <path style="fill:#%SYMBOLIC%" d="M 3,0 C 2.446,0 2,0.446 2,1 V 3 C 2,2.446 2.446,2 3,2 H 13 C 13.554,2 14,2.446 14,3 V 1 C 14,0.446 13.554,0 13,0 Z M 3,3 C 2.446,3 2,3.446 2,4 V 5 H 14 V 4 C 14,3.446 13.554,3 13,3 Z M 1,6 C 0.446,6 0,6.446 0,7 V 15 C 0,15.554 0.446,16 1,16 H 15 C 15.554,16 16,15.554 16,15 V 7 C 16,6.446 15.554,6 15,6 Z M 6.25,10 H 9.75 C 9.889,10 10,10.111 10,10.25 V 10.75 C 10,10.889 9.888,11 9.75,11 H 6.25 C 6.111,11 6,10.889 6,10.75 V 10.25 C 6,10.111 6.112,10 6.25,10 Z"/>
 </svg>
diff --git a/plugins/icons_papirus/oomox_plugin.py b/plugins/icons_papirus/oomox_plugin.py
index d10be18e..637b9f8d 100644
--- a/plugins/icons_papirus/oomox_plugin.py
+++ b/plugins/icons_papirus/oomox_plugin.py
@@ -33,21 +33,6 @@ class Plugin(OomoxIconsPlugin):
     preview_svg_dir = os.path.join(PLUGIN_DIR, "icon_previews/")

     theme_model_icons = [
-        {
-            'key': 'ICONS_PAPIRUS_THEME',
-            'type': 'options',
-            'options': [{
-                'value': 'Papirus',
-                'display_name': 'Papirus',
-            }, {
-                'value': 'Papirus-Dark',
-                'display_name': 'Papirus-Dark',
-            }, {
-                'value': 'Papirus-Light',
-                'display_name': 'Papirus-Light',
-            }],
-            'display_name': _('Base Theme'),
-        },
         {
             'key': 'ICONS_LIGHT_FOLDER',
             'type': 'color',
@@ -66,6 +51,12 @@ class Plugin(OomoxIconsPlugin):
             'fallback_key': 'HDR_BG',
             'display_name': _('Dark Stroke'),
         },
+        {
+            'key': 'ICONS_SYMBOLIC',
+            'type': 'color',
+            'fallback_key': 'MENU_FG',
+            'display_name': _('Symbolic Icons'),
+        },
     ]

     def preview_transform_function(self, svg_template, colorscheme):
@@ -75,4 +66,6 @@ class Plugin(OomoxIconsPlugin):
             "%MEDIUM%", colorscheme["ICONS_MEDIUM"] or FALLBACK_COLOR
         ).replace(
             "%DARK%", colorscheme["ICONS_DARK"] or FALLBACK_COLOR
+        ).replace(
+            "%SYMBOLIC%", colorscheme["ICONS_SYMBOLIC"] or FALLBACK_COLOR
         )
SmartFinn commented 5 years ago

Changing #dfdfdf color is not enough to replace the Base Theme menu.

Need to replace at least 2 colors to customize the icon theme for GTK themes:

actionless commented 5 years ago

would you suggest some display names for those two options?

SmartFinn commented 5 years ago

Something like Actions Icons and Panel Icons I guess...

actionless commented 5 years ago

and which of 3 Papirus variants should be used as a base?

SmartFinn commented 5 years ago

Papirus, it include all of the icons.

SmartFinn commented 5 years ago

Do you need help with the script? It looks easy. Need to add two block under Replacing colors section:

if [ -n "${ICONS_PAPIRUS_ACTIONS:-}" ]; then
   find <list of dirs> -type f -exec sed -i -e <exp> +
fi 

if [ -n "${ICONS_PAPIRUS_PANEL:-}" ]; then
   find <list of dirs> -type f -exec sed -i -e <exp> +
fi 
actionless commented 5 years ago

here's what i have currently, you could polish it and make a new PR:

diff --git a/plugins/icons_papirus/change_color.sh b/plugins/icons_papirus/change_color.sh
index 9846fbc0..53988f30 100755
--- a/plugins/icons_papirus/change_color.sh
+++ b/plugins/icons_papirus/change_color.sh
@@ -97,7 +97,6 @@ trap post_clean_up EXIT SIGHUP SIGINT SIGTERM

 : "${ICONS_COLOR:=$SEL_BG}"
-: "${ICONS_PAPIRUS_THEME:=Papirus}"  # Papirus | Papirus-Dark | Papirus-Light
 : "${OUTPUT_THEME_NAME:=oomox-$THEME}"

 output_dir="$HOME/.icons/$OUTPUT_THEME_NAME"
@@ -109,22 +108,32 @@ dark_stroke_fallback="$(darker "$ICONS_COLOR" 56)"
 : "${ICONS_LIGHT_FOLDER:=$light_folder_fallback}"
 : "${ICONS_MEDIUM:=$medium_base_fallback}"
 : "${ICONS_DARK:=$dark_stroke_fallback}"
+: "${ICONS_SYMBOLIC:=$dark_stroke_fallback}"

 echo ":: Copying theme template..."
 cp -R "$root/papirus-icon-theme/Papirus" "$tmp_dir/"
-
-if [ "$ICONS_PAPIRUS_THEME" != "Papirus" ]; then
-   find "$root/papirus-icon-theme/$ICONS_PAPIRUS_THEME" -type f -name '*.svg' \
-       -printf '%P\n' | while read -r file_path; do
-       cp -f "$root/papirus-icon-theme/$ICONS_PAPIRUS_THEME/$file_path" \
-           "$tmp_dir/Papirus/$file_path"
-   done
-fi
 echo "== Template was copied to $tmp_dir"

+echo ":: Replacing symbolic panel colors..."
+find "$tmp_dir"/Papirus/*/panel/ -type f -name '*.svg' \
+   | while read -r file_path; do
+   sed -i'' \
+       -e "s/dfdfdf/$ICONS_SYMBOLIC_PANEL/g" \
+       "$file_path"
+done
+
+echo ":: Replacing symbolic actions colors..."
+find "$tmp_dir/Papirus" -type f -name '*.svg' \
+   | while read -r file_path; do
+   sed -i'' \
+       -e "s/444444/$ICONS_SYMBOLIC_ACTION/g" \
+       "$file_path"
+done
+
+

-echo ":: Replacing colors..."
+echo ":: Replacing accent colors..."
 for size in 22x22 24x24 32x32 48x48 64x64; do
    for icon_path in \
        "$tmp_dir/Papirus/$size/places/folder-custom"{-*,}.svg \
diff --git a/plugins/icons_papirus/icon_previews/system-file-manager.svg.template b/plugins/icons_papirus/icon_previews/system-file-manager.svg.template
index bd15d5fe..a853fcf1 100644
--- a/plugins/icons_papirus/icon_previews/system-file-manager.svg.template
+++ b/plugins/icons_papirus/icon_previews/system-file-manager.svg.template
@@ -1,8 +1,3 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" version="1">
- <rect style="opacity:0.2" width="40" height="26" x="4" y="17" rx="2" ry="2"/>
- <path style="fill:#%MEDIUM%" d="M 4,34 C 4,35.108 4.892,36 6,36 H 42 C 43.108,36 44,35.108 44,34 V 12 C 44,10.892 43.108,10 42,10 H 22 V 8 C 22,6.892 21.108,6 20,6 H 6 C 4.892,6 4,6.892 4,8"/>
- <rect style="opacity:0.2" width="40" height="26" x="4" y="15" rx="2" ry="2"/>
- <rect style="fill:#e4e4e4" width="36" height="16" x="6" y="13" rx="2" ry="2"/>
- <rect style="fill:#%LIGHT%" width="40" height="26" x="4" y="16" rx="2" ry="2"/>
- <path style="opacity:0.1;fill:#ffffff" d="M 6,6 C 4.892,6 4,6.892 4,8 V 9 C 4,7.892 4.892,7 6,7 H 20 C 21.108,7 22,7.892 22,9 V 8 C 22,6.892 21.108,6 20,6 Z M 22,10 V 11 H 42 C 43.108,11 44,11.892 44,13 V 12 C 44,10.892 43.108,10 42,10 Z"/>
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
+ <path style="fill:#%SYMBOLIC_ACTION%" d="M 3,0 C 2.446,0 2,0.446 2,1 V 3 C 2,2.446 2.446,2 3,2 H 13 C 13.554,2 14,2.446 14,3 V 1 C 14,0.446 13.554,0 13,0 Z M 3,3 C 2.446,3 2,3.446 2,4 V 5 H 14 V 4 C 14,3.446 13.554,3 13,3 Z M 1,6 C 0.446,6 0,6.446 0,7 V 15 C 0,15.554 0.446,16 1,16 H 15 C 15.554,16 16,15.554 16,15 V 7 C 16,6.446 15.554,6 15,6 Z M 6.25,10 H 9.75 C 9.889,10 10,10.111 10,10.25 V 10.75 C 10,10.889 9.888,11 9.75,11 H 6.25 C 6.111,11 6,10.889 6,10.75 V 10.25 C 6,10.111 6.112,10 6.25,10 Z"/>
 </svg>
diff --git a/plugins/icons_papirus/icon_previews/user-desktop.svg.template b/plugins/icons_papirus/icon_previews/user-desktop.svg.template
index 86dd4c30..db10a142 100644
--- a/plugins/icons_papirus/icon_previews/user-desktop.svg.template
+++ b/plugins/icons_papirus/icon_previews/user-desktop.svg.template
@@ -1,7 +1,10 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" version="1.1">
- <rect style="opacity:0.2" width="40" height="36" x="4" y="7" rx="2" ry="2"/>
- <path style="fill:#%LIGHT%" d="M 4,9.9 4,40 c 0,1.108 0.892,2 2,2 l 36,0 c 1.108,0 2,-0.892 2,-2 L 44,9.9 Z"/>
- <path style="fill:#%DARK%" d="M 6,6 C 4.892,6 4,6.892 4,8 V 10 H 44 V 8 C 44,6.892 43.108,6 42,6 Z"/>
- <path style="fill:#%DARK%" d="M 16,38 C 14.892,38 14,38.892 14,40 V 42 H 34 V 40 C 34,38.892 33.108,38 32,38 Z"/>
- <path style="opacity:.1;fill:#ffffff" d="m6 6c-1.108 0-2 0.892-2 2v1c0-1.108 0.892-2 2-2h36c1.108 0 2 0.892 2 2v-1c0-1.108-0.892-2-2-2z"/>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" version="1.1">
+ <defs>
+  <style id="current-color-scheme" type="text/css">
+   .ColorScheme-Text { color:#%SYMBOLIC_PANEL%; } .ColorScheme-Highlight { color:#5294e2; }
+  </style>
+ </defs>
+ <g transform="matrix(1,0,0,1,1,1)">
+  <path style="fill:currentColor" class="ColorScheme-Text" d="M 4,4 C 3.446,4 3,4.446 3,5 V 15 C 3,15.554 3.446,16 4,16 H 9 C 8.446,16 8,16.446 8,17 V 18 H 14 V 17 C 14,16.446 13.554,16 13,16 H 18 C 18.554,16 19,15.554 19,15 V 5 C 19,4.446 18.554,4 18,4 Z M 5,6 H 17 V 14 H 5 Z"/>
+ </g>
 </svg>
diff --git a/plugins/icons_papirus/oomox_plugin.py b/plugins/icons_papirus/oomox_plugin.py
index d10be18e..ffe8906b 100644
--- a/plugins/icons_papirus/oomox_plugin.py
+++ b/plugins/icons_papirus/oomox_plugin.py
@@ -33,21 +33,6 @@ class Plugin(OomoxIconsPlugin):
     preview_svg_dir = os.path.join(PLUGIN_DIR, "icon_previews/")

     theme_model_icons = [
-        {
-            'key': 'ICONS_PAPIRUS_THEME',
-            'type': 'options',
-            'options': [{
-                'value': 'Papirus',
-                'display_name': 'Papirus',
-            }, {
-                'value': 'Papirus-Dark',
-                'display_name': 'Papirus-Dark',
-            }, {
-                'value': 'Papirus-Light',
-                'display_name': 'Papirus-Light',
-            }],
-            'display_name': _('Base Theme'),
-        },
         {
             'key': 'ICONS_LIGHT_FOLDER',
             'type': 'color',
@@ -66,6 +51,18 @@ class Plugin(OomoxIconsPlugin):
             'fallback_key': 'HDR_BG',
             'display_name': _('Dark Stroke'),
         },
+        {
+            'key': 'ICONS_SYMBOLIC_PANEL',
+            'type': 'color',
+            'fallback_key': 'HDR_FG',
+            'display_name': _('Panel Icons'),
+        },
+        {
+            'key': 'ICONS_SYMBOLIC_ACTION',
+            'type': 'color',
+            'fallback_key': 'MENU_FG',
+            'display_name': _('Actions Icons'),
+        },
     ]

     def preview_transform_function(self, svg_template, colorscheme):
@@ -75,4 +72,8 @@ class Plugin(OomoxIconsPlugin):
             "%MEDIUM%", colorscheme["ICONS_MEDIUM"] or FALLBACK_COLOR
         ).replace(
             "%DARK%", colorscheme["ICONS_DARK"] or FALLBACK_COLOR
+        ).replace(
+            "%SYMBOLIC_PANEL%", colorscheme["ICONS_SYMBOLIC_PANEL"] or FALLBACK_COLOR
+        ).replace(
+            "%SYMBOLIC_ACTION%", colorscheme["ICONS_SYMBOLIC_ACTION"] or FALLBACK_COLOR
         )
SmartFinn commented 5 years ago

Ok, I'll do.

actionless commented 5 years ago

thanks in advance!