aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-10-12 18:51:28 +0200
committerMattias Andrée <maandree@kth.se>2020-10-12 18:51:28 +0200
commitb7a164c2d1f3ad9e551ec2f98c502b262f1eb6cd (patch)
tree394d07ba47486bd9e4479ae807bdd21a07eab137
parentAdd apps/org.inkscape.Inkscape and apps/wire-desktop (diff)
downloadsimple-icon-theme-b7a164c2d1f3ad9e551ec2f98c502b262f1eb6cd.tar.gz
simple-icon-theme-b7a164c2d1f3ad9e551ec2f98c502b262f1eb6cd.tar.bz2
simple-icon-theme-b7a164c2d1f3ad9e551ec2f98c502b262f1eb6cd.tar.xz
Make it easy to change the colours
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--.gitignore1
-rw-r--r--Makefile68
-rw-r--r--README5
-rw-r--r--config.mk30
-rw-r--r--conv.c6
5 files changed, 85 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore
index e59bfcd..6cbd03c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
*~
*\#*
/*x*/
+/scalable-*/
*.theme
conv
*.o
diff --git a/Makefile b/Makefile
index f47843d..93f35ca 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,7 @@
.NONPOSIX:
-PREFIX = /usr
-ICONPREFIX = $(PREFIX)/share/icons
-
-SIZES = 16 24 32 48
+CONFIGFILE = config.mk
+include $(CONFIGFILE)
DIRS =\
actions\
@@ -4118,7 +4116,7 @@ ICONS =\
#apps/mozo
# apps/alacarte
-ALL_PNG_ICONS = $(foreach S,$(SIZES),$(foreach I,$(ICONS),$(S)x$(S)/$(I).png))
+ALL_PNG_ICONS = $(foreach S,$(SIZES),$(foreach I,$(ICONS),$(S)x$(S)$(DIR_SUFFIX)/$(I).png))
all: index.theme $(ALL_PNG_ICONS)
@@ -4128,8 +4126,8 @@ index.theme: Makefile
set -e;\
printf '%s\n' \
'[Icon Theme]'\
- 'Name=Simple'\
- 'Comment=A very simple icon theme'\
+ 'Name=$(THEME_NAME)'\
+ 'Comment=$(THEME_DESC)'\
'Example=folder'\
''\
'# KDE specific stuff'\
@@ -4171,31 +4169,56 @@ index.theme: Makefile
all-fast-icons: $(ICONS:=.x)
+scalable-$(DIR_SUFFIX_)/%.svg: scalable/%.svg
+ @mkdir -p -- "$$(dirname "$@")"
+ if ! test "$@" = "scalable/$*.svg"; then\
+ if test -L "scalable/$*.svg"; then\
+ ln -s "$$(readlink -- "scalable/$*.svg")" $@;\
+ else\
+ sed < scalable/$*.svg > $@\
+ -e 's/#[bB][eE][bB][eE][bB][eE]/#$(BASE_COLOUR)/g'\
+ -e 's/#[eE][fF]2929/#$(ALARM_RED)/g'\
+ -e 's/#[fF]57900/#$(ALARM_ORANGE)/g'\
+ -e 's/#[cC][dD]656[cC]/#$(RED)/g'\
+ -e 's/#[dD]69553/#$(ORANGE)/g'\
+ -e 's/#[cC][cC][aA][dD]47/#$(YELLOW)/g'\
+ -e 's/#32[aA]679/#$(GREEN)/g'\
+ -e 's/#00[aA]09[fF]/#$(CYAN)/g'\
+ -e 's/#2495[bB][eE]/#$(BLUE)/g'\
+ -e 's/#[aA]46[eE][bB]0/#$(MAGENTA)/g'\
+ -e 's/#000000/#$(OUTLINE)/g';\
+ fi;\
+ fi
+
%.x: conv
- ./conv scalable/$*.svg $(SIZES)
+ @if test -n "$(DIR_SUFFIX)"; then make scalable$(DIR_SUFFIX)/$*.svg; fi
+ @ # Does work as a dependeny in GNU make for some reason,
+ @ # additionally, this lets us avoid starting make once
+ @ # extra for every icon
+ ./conv scalable$(DIR_SUFFIX)/$*.svg $(SIZES)
conv: conv.c
$(CC) -o $@ $< $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
-8x8/%.png: scalable/%.svg conv
+8x8$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
./conv $@
-16x16/%.png: scalable/%.svg conv
+16x16$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
./conv $@
-22x22/%.png: scalable/%.svg conv
+22x22$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
./conv $@
-24x24/%.png: scalable/%.svg conv
+24x24$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
./conv $@
-32x32/%.png: scalable/%.svg conv
+32x32$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
./conv $@
-36x36/%.png: scalable/%.svg conv
+36x36$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
./conv $@
-48x48/%.png: scalable/%.svg conv
+48x48$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
./conv $@
install: index.theme $(ALL_PNG_ICONS)
@@ -4203,24 +4226,25 @@ install: index.theme $(ALL_PNG_ICONS)
set -e;\
for d in $(DIRS); do\
for s in $(SIZES); do\
- mkdir -p -- "$(DESTDIR)$(ICONPREFIX)/simple/$${s}x$${s}/$${d}";\
+ mkdir -p -- "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)/$${s}x$${s}/$${d}";\
done;\
- mkdir -p -- "$(DESTDIR)$(ICONPREFIX)/simple/scalable/$${d}";\
+ mkdir -p -- "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)/scalable/$${d}";\
done
set -e;\
for i in $(ICONS); do\
for s in $(SIZES); do\
- cp -P -- "$${s}x$${s}/$${i}.png" "$(DESTDIR)$(ICONPREFIX)/simple/$${s}x$${s}/$${i}.png";\
+ cp -P -- "$${s}x$${s}$(DIR_SUFFIX)/$${i}.png" "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)/$${s}x$${s}/$${i}.png";\
done;\
- cp -P -- "scalable/$${i}.svg" "$(DESTDIR)$(ICONPREFIX)/simple/scalable/$${i}.svg";\
+ cp -P -- "scalable$(DIR_SUFFIX)/$${i}.svg" "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)/scalable/$${i}.svg";\
done
- cp -- index.theme "$(DESTDIR)$(ICONPREFIX)/simple/index.theme"
+ cp -- index.theme "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)/index.theme"
uninstall:
- rm -rf -- "$(DESTDIR)$(ICONPREFIX)/simple"
+ rm -rf -- "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)"
clean:
-rm -f -- index.theme *.o *.su conv
- -for s in $(SIZES); do printf "$${s}x$${s}\n"; done | xargs rm -rf --
+ -if test -n "$(DIR_SUFFIX)"; then rm -rf -- scalable$(DIR_SUFFIX); fi
+ -for s in $(SIZES); do printf "$${s}x$${s}$(DIR_SUFFIX)\n"; done | xargs rm -rf --
.PHONY: all all-fast all-fast-icons install uninstall clean
diff --git a/README b/README
index f0846cb..14a2bb1 100644
--- a/README
+++ b/README
@@ -32,3 +32,8 @@ Design:
should have a 1 pixel black (#000000) outline
• SVG files should be cleaned up with `svgcleaner`
+
+Colours are customisable via config.mk.
+
+When building, it is a good idea to run `make all-fast -j`
+rather than `make all -j` or `make -j` (also if without -j).
diff --git a/config.mk b/config.mk
new file mode 100644
index 0000000..db05de0
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,30 @@
+PREFIX = /usr
+ICONPREFIX = $(PREFIX)/share/icons
+
+THEME_NAME = Simple
+THEME_DESC = A very simple icon theme
+THEME_DIR = simple
+BASE_COLOUR = bebebe
+ALARM_RED = ef2929
+ALARM_ORANGE = f57900
+RED = cd656c
+ORANGE = d69553
+YELLOW = ccad47
+GREEN = 32a679
+CYAN = 00a09f
+BLUE = 2495be
+MAGENTA = a46eb0
+OUTLINE = 000000
+
+#DIR_SUFFIX_ = $(BASE_COLOUR)-$(ALARM_RED)-$(ALARM_ORANGE)-$(RED)-$(ORANGE)-$(YELLOW)-$(GREEN)-$(CYAN)-$(BLUE)-$(MAGENTA)-$(OUTLINE)
+#DIR_SUFFIX = -$(DIR_SUFFIX_)
+# Uncomment the two lines above if you want to use customised colours
+
+SIZES = 16 24 32 48
+# Supported sizes are 8, 16, 22, 24, 32, 36, and 48,
+# you you want any other size add
+#
+# ###x###$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
+# ./conv $@
+#
+# with ### replaces for the size to add support for.
diff --git a/conv.c b/conv.c
index 7c5480e..3decbfd 100644
--- a/conv.c
+++ b/conv.c
@@ -12,7 +12,7 @@ static char *argv0;
static int
single(int argc, char *argv[])
{
- char size[10], target[4096], source[4096];
+ char size[256], target[4096], source[4096];
char *p;
ssize_t r;
int fd;
@@ -24,7 +24,7 @@ single(int argc, char *argv[])
stpcpy(size, argv[0]);
*p = 'x';
- p = strchr(p, '/');
+ p = &p[strcspn(p, "-/")];
if (!p)
return 1;
p = stpcpy(stpcpy(source, "scalable"), p);
@@ -90,7 +90,7 @@ multi(int argc, char *argv[])
source = *argv++, argc--;
- q = strchr(source, '/');
+ q = &source[strcspn(source, "-/")];
if (!q)
return 1;