diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 85fadd14..adf51bc6 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,9 +1,11 @@ # Creating an issue -When reporting bugs keep in mind that the people working on it do this unpaid, in their free time and as a hobby. So be -polite and helpful. Bug reports that demand, contain insults to this or other projects, or have a general unfriendly -tone will be closed without discussion. Everybody has it own way of working; What might be the norm for you, might not -be for others. Therefore be verbose in your description. +When reporting bugs keep in mind that the people working on it do this unpaid, +in their free time and as a hobby. So be polite and helpful. Bug reports that +demand, contain insults to this or other projects, or have a general unfriendly +tone will be closed without discussion. Everybody has it own way of working; +What might be the norm for you, might not be for others. Therefore be verbose in +your description. Before creating an issue: @@ -21,17 +23,30 @@ When reporting bugs include the following information: * A proper title for others to search for. * Be exact. +When adding comments to an issue make sure: + +* It is relevant to the issue. +* It contributes to solving the issue. +* Use :+1: :-1: emojis instead of replying 'me too' or 'I also have this.' + + +Issue high-jacking, e.g. adding a request/issue to an existing issue, is very +disruptive. +Please create a new issue, if it is similar it will be marked duplicate. + The issue tracker is not for: * Questions. * Writing complaints. -These topics belong on [FORUM](https://reddit.com/r/qtools//), [IRC](https://webchat.freenode.net/?channels=#rofi), -frequently asked questions will be added to the [F.A.Q](https://github.com/DaveDavenport/rofi/wiki#faq) on the -[wiki](https://github.com/DaveDavenport/rofi/wiki). +These topics belong on [FORUM](https://reddit.com/r/qtools//), +[IRC](https://webchat.freenode.net/?channels=#rofi), frequently asked questions +will be added to the [F.A.Q](https://github.com/DaveDavenport/rofi/wiki#faq) on +the [wiki](https://github.com/DaveDavenport/rofi/wiki). -Questions filled in on the bug tracker will be marked `question`, locked and closed. If the question is clear, I -normally try to provide an answer. +Questions filled in on the bug tracker will be marked `question`, locked and +closed. If the question is clear, I normally try to provide an answer. -**Please do not submit reports related to wayland, see [here](https://github.com/DaveDavenport/rofi/wiki/Wayland) for -more information.** +**Please do not submit reports related to wayland, see +[here](https://github.com/DaveDavenport/rofi/wiki/Wayland) for more +information.** diff --git a/.travis.yml b/.travis.yml index 948d224b..98b07ef3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -81,6 +81,7 @@ before_script: script: - ninja -C build - ninja -C build test + - ./theme_parser_test - ulimit -c unlimited - ninja -C build test-x - ninja -C build doc/html 2>&1 > doxygen.log diff --git a/Makefile.am b/Makefile.am index a5b9de78..d839ac06 100644 --- a/Makefile.am +++ b/Makefile.am @@ -60,6 +60,7 @@ SOURCES=\ source/widgets/scrollbar.c\ source/xrmoptions.c\ source/x11-helper.c\ + source/css-colors.c\ source/dialogs/run.c\ source/dialogs/ssh.c\ source/dialogs/drun.c\ @@ -82,6 +83,7 @@ SOURCES=\ include/timings.h\ include/history.h\ include/theme.h\ + include/css-colors.h\ include/default-theme.h\ include/widgets/box.h\ include/widgets/container.h\ @@ -319,6 +321,7 @@ widget_test_SOURCES=\ source/widgets/widget.c\ source/widgets/textbox.c\ source/theme.c\ + source/css-colors.c\ source/helper.c\ source/x11-helper.c\ config/config.c\ @@ -334,7 +337,9 @@ box_test_SOURCES=\ lexer/theme-parser.y\ lexer/theme-lexer.l\ source/theme.c\ + source/css-colors.c\ include/theme.h\ + include/css-colors.h\ test/box-test.c scrollbar_test_LDADD=$(textbox_test_LDADD) @@ -345,7 +350,9 @@ scrollbar_test_SOURCES=\ lexer/theme-parser.y\ lexer/theme-lexer.l\ source/theme.c\ + source/css-colors.c\ include/theme.h\ + include/css-colors.h\ test/scrollbar-test.c textbox_test_SOURCES=\ @@ -354,6 +361,7 @@ textbox_test_SOURCES=\ lexer/theme-parser.y\ lexer/theme-lexer.l\ source/theme.c\ + source/css-colors.c\ source/helper.c\ source/x11-helper.c\ config/config.c\ @@ -382,6 +390,7 @@ theme_parser_test_SOURCES=\ include/helper.h\ include/helper-theme.h\ include/theme.h\ + include/css-colors.h\ include/xrmoptions.h\ source/xrmoptions.c\ source/x11-helper.c\ @@ -389,6 +398,7 @@ theme_parser_test_SOURCES=\ lexer/theme-parser.c\ lexer/theme-parser.h\ source/theme.c\ + source/css-colors.c\ test/theme-parser-test.c endif @@ -530,9 +540,13 @@ test-x: $(bin_PROGRAMS) echo "Test dmenu glob" $(top_srcdir)/test/run_test.sh 216 $(top_srcdir)/test/run_glob_test.sh $(top_builddir) echo "Test issue 333" - $(top_srcdir)/test/run_test.sh 221 $(top_srcdir)/test/run_issue333_test.sh $(top_builddir) + $(top_srcdir)/test/run_test.sh 217 $(top_srcdir)/test/run_issue333_test.sh $(top_builddir) echo "Test help output" - $(top_srcdir)/test/run_test.sh 212 $(top_srcdir)/test/help_output_test.sh $(top_builddir) $(top_srcdir) + $(top_srcdir)/test/run_test.sh 218 $(top_srcdir)/test/help_output_test.sh $(top_builddir) $(top_srcdir) + echo "Test theme output" + $(top_srcdir)/test/run_test.sh 219 $(top_srcdir)/test/default_theme_test.sh $(top_builddir) $(top_srcdir) + echo "Test theme convert output" + $(top_srcdir)/test/run_test.sh 220 $(top_srcdir)/test/convert_old_theme_test.sh $(top_builddir) $(top_srcdir) test-x1: $(bin_PROGRAMS) echo "Test dmenu-normal-window" diff --git a/configure.ac b/configure.ac index 21f21161..0445e422 100644 --- a/configure.ac +++ b/configure.ac @@ -101,6 +101,7 @@ AC_CHECK_FUNC([fcntl],, AC_MSG_ERROR("Could not find fcntl")) AC_CHECK_FUNC([setlocale],,AC_MSG_ERROR("Could not find setlocale")) AC_CHECK_FUNC([atexit],, AC_MSG_ERROR("Could not find atexit in c library")) AC_CHECK_FUNC([glob],, AC_MSG_ERROR("Could not find glob in c library")) +AC_CHECK_FUNC([toupper],, AC_MSG_ERROR("Could not find toupper in c library")) AC_CHECK_HEADER([math.h],, AC_MSG_ERROR("Could not find math.h header file")) AC_SEARCH_LIBS([floor],[m],, AC_MSG_ERROR("Could not find floor in math library")) @@ -117,10 +118,14 @@ dnl PKG_CONFIG based dependencies dnl --------------------------------------------------------------------- PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.40 gio-unix-2.0 gmodule-2.0]) GW_CHECK_XCB([xcb-aux xcb-xkb xkbcommon >= 0.5.0 xkbcommon-x11 xcb-ewmh xcb-icccm xcb-xrm xcb-randr xcb-xinerama]) +PKG_CHECK_EXISTS([xkbcommon >= 0.7.0], [AC_DEFINE([XkBCOMMON_HAS_CONSUMED2], [1], [If xkbcommon has the consumed2 API])]) PKG_CHECK_MODULES([pango], [pango pangocairo]) PKG_CHECK_MODULES([cairo], [cairo cairo-xcb]) PKG_CHECK_MODULES([libsn], [libstartup-notification-1.0 ]) +dnl --------------------------------------------------------------------- +dnl check - Unit testing. +dnl --------------------------------------------------------------------- AC_ARG_ENABLE([check], AS_HELP_STRING([--disable-check], [Build with checks using check library (default: enabled)])) AS_IF([test "x${enable_check}" != "xno"], [ PKG_CHECK_MODULES([check],[check >= 0.11.0], [HAVE_CHECK=1]) ]) diff --git a/doc/default_theme.rasi b/doc/default_theme.rasi new file mode 100644 index 00000000..23c33889 --- /dev/null +++ b/doc/default_theme.rasi @@ -0,0 +1,115 @@ +* { + foreground: rgba ( 0, 43, 54, 100 % ); + selected-normal-foreground: @lightbg; + normal-foreground: @foreground; + red: rgba ( 220, 50, 47, 100 % ); + alternate-normal-background: @lightbg; + blue: rgba ( 38, 139, 210, 100 % ); + selected-urgent-foreground: @background; + urgent-foreground: @red; + alternate-urgent-background: @lightbg; + active-foreground: @blue; + lightbg: rgba ( 238, 232, 213, 100 % ); + selected-active-foreground: @background; + alternate-normal-foreground: @foreground; + alternate-active-background: @lightbg; + bordercolor: @foreground; + background: rgba ( 253, 246, 227, 100 % ); + normal-background: @background; + lightfg: rgba ( 88, 104, 117, 100 % ); + selected-normal-background: @lightfg; + separatorcolor: @foreground; + spacing: 2; + urgent-background: @background; + alternate-urgent-foreground: @red; + selected-urgent-background: @red; + alternate-active-foreground: @blue; + selected-active-background: @blue; + active-background: @background; +} +#window { + border: 1; + foreground: @foreground; + background: rgba ( 0, 0, 0, 0 % ); + padding: 5; +} +#window.box { + foreground: @bordercolor; + background: @background; +} +#window.mainbox { + border: 0; + padding: 0; +} +#window.mainbox.message.box { + border: 1px dash 0px 0px ; + foreground: @separatorcolor; + padding: 2px 0px 0px ; +} +#window.mainbox.message.normal { + foreground: @foreground; +} +#window.mainbox.listview { + fixed-height: 0; + border: 1px dash 0px 0px ; + padding: 2px 0px 0px ; +} +#window.mainbox.listview.element { + border: 0; +} +#window.mainbox.listview.element.normal.normal { + foreground: @normal-foreground; + background: @normal-background; +} +#window.mainbox.listview.element.normal.urgent { + foreground: @urgent-foreground; + background: @urgent-background; +} +#window.mainbox.listview.element.normal.active { + foreground: @active-foreground; + background: @active-background; +} +#window.mainbox.listview.element.selected.normal { + foreground: @selected-normal-foreground; + background: @selected-normal-background; +} +#window.mainbox.listview.element.selected.urgent { + foreground: @selected-urgent-foreground; + background: @selected-urgent-background; +} +#window.mainbox.listview.element.selected.active { + foreground: @selected-active-foreground; + background: @selected-active-background; +} +#window.mainbox.listview.element.alternate.normal { + foreground: @alternate-normal-foreground; + background: @alternate-normal-background; +} +#window.mainbox.listview.element.alternate.urgent { + foreground: @alternate-urgent-foreground; + background: @alternate-urgent-background; +} +#window.mainbox.listview.element.alternate.active { + foreground: @alternate-active-foreground; + background: @alternate-active-background; +} +#window.mainbox.listview.scrollbar { + border: 0; + padding: 0; +} +#window.mainbox.sidebar.box { + border: 1px dash 0px 0px ; +} +#window.mainbox.sidebar.button.selected { + foreground: @selected-normal-foreground; + background: @selected-normal-background; +} +#window.mainbox.inputbar { + spacing: 0; +} +#window.mainbox.inputbar.box { + border: 0px ; +} +#window.mainbox.inputbar.normal { + foreground: @foreground; +} diff --git a/doc/old-theme-convert-input.theme b/doc/old-theme-convert-input.theme new file mode 100644 index 00000000..eb4d2d4d --- /dev/null +++ b/doc/old-theme-convert-input.theme @@ -0,0 +1,15 @@ +! ------------------------------------------------------------------------------ +! ROFI Color theme +! User: qball +! Copyright: Dave Davenport +! ------------------------------------------------------------------------------ +! "Color scheme for normal row" Set from: File +rofi.color-normal: argb:00000000, #dbdfbc, argb:00000000, #dbdfbc, #02143f +! "Color scheme for urgent row" Set from: File +rofi.color-urgent: argb:00000000, #ff81ff, argb:00000000, #ff817f, #02143f +! "Color scheme for active row" Set from: File +rofi.color-active: argb:00000000, #8ac4ff, argb:00000000, #8ac4ff, #02143f +! "Color scheme window" Set from: File +rofi.color-window: argb:dd000021, #dbdfbc, #dbdfbc +! "Separator style (none, dash, solid)" Set from: XResources +rofi.separator-style: solid diff --git a/doc/old-theme-convert-output.rasi b/doc/old-theme-convert-output.rasi new file mode 100644 index 00000000..3d03e77c --- /dev/null +++ b/doc/old-theme-convert-output.rasi @@ -0,0 +1,115 @@ +* { + foreground: rgba ( 219, 223, 188, 100 % ); + selected-normal-foreground: rgba ( 2, 20, 63, 100 % ); + normal-foreground: @foreground; + red: rgba ( 220, 50, 47, 100 % ); + alternate-normal-background: rgba ( 0, 0, 0, 0 % ); + blue: rgba ( 38, 139, 210, 100 % ); + selected-urgent-foreground: rgba ( 2, 20, 63, 100 % ); + urgent-foreground: rgba ( 255, 129, 255, 100 % ); + alternate-urgent-background: rgba ( 0, 0, 0, 0 % ); + active-foreground: rgba ( 138, 196, 255, 100 % ); + lightbg: rgba ( 238, 232, 213, 100 % ); + selected-active-foreground: rgba ( 2, 20, 63, 100 % ); + alternate-normal-foreground: @foreground; + alternate-active-background: rgba ( 0, 0, 0, 0 % ); + bordercolor: rgba ( 219, 223, 188, 100 % ); + background: rgba ( 0, 0, 33, 87 % ); + normal-background: rgba ( 0, 0, 0, 0 % ); + lightfg: rgba ( 88, 104, 117, 100 % ); + selected-normal-background: rgba ( 219, 223, 188, 100 % ); + separatorcolor: rgba ( 219, 223, 188, 100 % ); + spacing: 2; + urgent-background: rgba ( 0, 0, 0, 0 % ); + alternate-urgent-foreground: @urgent-foreground; + selected-urgent-background: rgba ( 255, 129, 127, 100 % ); + alternate-active-foreground: @active-foreground; + selected-active-background: rgba ( 138, 196, 255, 100 % ); + active-background: rgba ( 0, 0, 0, 0 % ); +} +#window { + border: 1; + foreground: @foreground; + background: rgba ( 0, 0, 0, 0 % ); + padding: 5; +} +#window.box { + foreground: @bordercolor; + background: @background; +} +#window.mainbox { + border: 0; + padding: 0; +} +#window.mainbox.message.box { + border: 1px dash 0px 0px ; + foreground: @separatorcolor; + padding: 2px 0px 0px ; +} +#window.mainbox.message.normal { + foreground: @foreground; +} +#window.mainbox.listview { + fixed-height: 0; + border: 1px dash 0px 0px ; + padding: 2px 0px 0px ; +} +#window.mainbox.listview.element { + border: 0; +} +#window.mainbox.listview.element.normal.normal { + foreground: @normal-foreground; + background: @normal-background; +} +#window.mainbox.listview.element.normal.urgent { + foreground: @urgent-foreground; + background: @urgent-background; +} +#window.mainbox.listview.element.normal.active { + foreground: @active-foreground; + background: @active-background; +} +#window.mainbox.listview.element.selected.normal { + foreground: @selected-normal-foreground; + background: @selected-normal-background; +} +#window.mainbox.listview.element.selected.urgent { + foreground: @selected-urgent-foreground; + background: @selected-urgent-background; +} +#window.mainbox.listview.element.selected.active { + foreground: @selected-active-foreground; + background: @selected-active-background; +} +#window.mainbox.listview.element.alternate.normal { + foreground: @alternate-normal-foreground; + background: @alternate-normal-background; +} +#window.mainbox.listview.element.alternate.urgent { + foreground: @alternate-urgent-foreground; + background: @alternate-urgent-background; +} +#window.mainbox.listview.element.alternate.active { + foreground: @alternate-active-foreground; + background: @alternate-active-background; +} +#window.mainbox.listview.scrollbar { + border: 0; + padding: 0; +} +#window.mainbox.sidebar.box { + border: 1px dash 0px 0px ; +} +#window.mainbox.sidebar.button.selected { + foreground: @selected-normal-foreground; + background: @selected-normal-background; +} +#window.mainbox.inputbar { + spacing: 0; +} +#window.mainbox.inputbar.box { + border: 0px ; +} +#window.mainbox.inputbar.normal { + foreground: @foreground; +} diff --git a/doc/rofi-theme-manpage.markdown b/doc/rofi-theme-manpage.markdown index 5a32f46e..f6eb2ef9 100644 --- a/doc/rofi-theme-manpage.markdown +++ b/doc/rofi-theme-manpage.markdown @@ -238,31 +238,66 @@ dynamic: false; ## Color -* Format: `#{HEX}{6}` -* Format: `#{HEX}{8}` -* Format: `rgb({INTEGER},{INTEGER},{INTEGER})` -* Format: `rgba({INTEGER},{INTEGER},{INTEGER}, {REAL})` +**rofi** supports the color formats as specified in the CSS standard (1,2,3 and some of CSS 4) -Where '{HEX}' is a hexidecimal number ('0-9a-f'). The '{INTEGER}' value can be between 0 and 255, the '{Real}' value -between 0.0 and 1.0. +* Format: `#{HEX}{3}` (rgb) +* Format: `#{HEX}{4}` (rgba) +* Format: `#{HEX}{6}` (rrggbb) +* Format: `#{HEX}{8}` (rrggbbaa) +* Format: `rgb[a]({INTEGER},{INTEGER},{INTEGER}[, {PERCENTAGE}])` +* Format: `rgb[a]({INTEGER}%,{INTEGER}%,{INTEGER}%[, {PERCENTAGE}])` +* Format: `hsl[a]( {ANGLE}, {PERCENTAGE}, {PERCENTAGE} [{PERCENTAGE}])` +* Format: `hwb[a]( {ANGLE}, {PERCENTAGE}, {PERCENTAGE} [{PERCENTAGE}])` +* Format: `cmyk( {PERCENTAGE}, {PERCENTAGE}, {PERCENTAGE}, {PERCENTAGE} [, {PERCENTAGE} ])` +* Format: `{named-color} [ / {PERCENTAGE} ]` + +The in CSS 4 proposed white-space format is also supported. + +The different values are: + + * `{HEX}` is a hexidecimal number ('0-9a-f' case insensitive). + * `{INTEGER}` value can be between 0 and 255 or 0-100 when representing percentage. + * `{ANGLE}` Angle on the color wheel, can be in `deg`, `rad`, `grad` or `turn`. When no unit is specified, degrees is assumed. + * `{PERCENTAGE}` Can be between 0-1.0, or 0%-100% + * `{named-color}` Is one of the following colors: + + AliceBlue, AntiqueWhite, Aqua, Aquamarine, Azure, Beige, Bisque, Black, BlanchedAlmond, Blue, BlueViolet, Brown, + BurlyWood, CadetBlue, Chartreuse, Chocolate, Coral, CornflowerBlue, Cornsilk, Crimson, Cyan, DarkBlue, DarkCyan, + DarkGoldenRod, DarkGray, DarkGrey, DarkGreen, DarkKhaki, DarkMagenta, DarkOliveGreen, DarkOrange, DarkOrchid, DarkRed, + DarkSalmon, DarkSeaGreen, DarkSlateBlue, DarkSlateGray, DarkSlateGrey, DarkTurquoise, DarkViolet, DeepPink, DeepSkyBlue, + DimGray, DimGrey, DodgerBlue, FireBrick, FloralWhite, ForestGreen, Fuchsia, Gainsboro, GhostWhite, Gold, GoldenRod, + Gray, Grey, Green, GreenYellow, HoneyDew, HotPink, IndianRed, Indigo, Ivory, Khaki, Lavender, LavenderBlush, LawnGreen, + LemonChiffon, LightBlue, LightCoral, LightCyan, LightGoldenRodYellow, LightGray, LightGrey, LightGreen, LightPink, + LightSalmon, LightSeaGreen, LightSkyBlue, LightSlateGray, LightSlateGrey, LightSteelBlue, LightYellow, Lime, LimeGreen, + Linen, Magenta, Maroon, MediumAquaMarine, MediumBlue, MediumOrchid, MediumPurple, MediumSeaGreen, MediumSlateBlue, + MediumSpringGreen, MediumTurquoise, MediumVioletRed, MidnightBlue, MintCream, MistyRose, Moccasin, NavajoWhite, Navy, + OldLace, Olive, OliveDrab, Orange, OrangeRed, Orchid, PaleGoldenRod, PaleGreen, PaleTurquoise, PaleVioletRed, + PapayaWhip, PeachPuff, Peru, Pink, Plum, PowderBlue, Purple, RebeccaPurple, Red, RosyBrown, RoyalBlue, SaddleBrown, + Salmon, SandyBrown, SeaGreen, SeaShell, Sienna, Silver, SkyBlue, SlateBlue, SlateGray, SlateGrey, Snow, SpringGreen, + SteelBlue, Tan, Teal, Thistle, Tomato, Turquoise, Violet, Wheat, White, WhiteSmoke, Yellow, YellowGreen -The first formats specify the color as RRGGBB (R = red, G = green, B = Blue), the second adds an alpha (A) channel: -AARRGGBB. For example: ``` background: #FF0000; foreground: rgba(0,0,1, 0.5); +text: SeaGreen; ``` ## Text style -* Format: `(bold|italic|underline|none)` +* Format: `(bold|italic|underline|strikethrough|none)` -Text style indicates how the text should be displayed. None indicates no style +Text style indicates how the highlighted text is emphasised. None indicates no emphasis should be applied. + * `bold`: make the text thicker then the surrounding text. + * `italic`: put the highlighted text in script type (slanted). + * `underline`: put a line under the highlighted text. + * `strikethrough`: put a line through the highlighted text. + * `small caps`: emphasise the text using capitalization. + ## Line style * Format: `(dash|solid)` diff --git a/doc/rofi-theme.5 b/doc/rofi-theme.5 index bbbe7241..21f8877c 100644 --- a/doc/rofi-theme.5 +++ b/doc/rofi-theme.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "ROFI\-THEME\-MANPAGE" "" "April 2017" "" "" +.TH "ROFI\-THEME\-MANPAGE" "" "May 2017" "" "" . .SH "NAME" \fBrofi\-theme\fR \- Rofi theme format files @@ -360,26 +360,65 @@ dynamic: false; .IP "" 0 . .SH "Color" +\fBrofi\fR supports the color formats as specified in the CSS standard (1,2,3 and some of CSS 4) . .IP "\(bu" 4 -Format: \fB#{HEX}{6}\fR +Format: \fB#{HEX}{3}\fR (rgb) . .IP "\(bu" 4 -Format: \fB#{HEX}{8}\fR +Format: \fB#{HEX}{4}\fR (rgba) . .IP "\(bu" 4 -Format: \fBrgb({INTEGER},{INTEGER},{INTEGER})\fR +Format: \fB#{HEX}{6}\fR (rrggbb) . .IP "\(bu" 4 -Format: \fBrgba({INTEGER},{INTEGER},{INTEGER}, {REAL})\fR +Format: \fB#{HEX}{8}\fR (rrggbbaa) +. +.IP "\(bu" 4 +Format: \fBrgb[a]({INTEGER},{INTEGER},{INTEGER}[, {PERCENTAGE}])\fR +. +.IP "\(bu" 4 +Format: \fBrgb[a]({INTEGER}%,{INTEGER}%,{INTEGER}%[, {PERCENTAGE}])\fR +. +.IP "\(bu" 4 +Format: \fBhsl[a]( {ANGLE}, {PERCENTAGE}, {PERCENTAGE} [{PERCENTAGE}])\fR +. +.IP "\(bu" 4 +Format: \fBhwb[a]( {ANGLE}, {PERCENTAGE}, {PERCENTAGE} [{PERCENTAGE}])\fR +. +.IP "\(bu" 4 +Format: \fBcmyk( {PERCENTAGE}, {PERCENTAGE}, {PERCENTAGE}, {PERCENTAGE} [, {PERCENTAGE} ])\fR +. +.IP "\(bu" 4 +Format: \fB{named\-color} [ / {PERCENTAGE} ]\fR . .IP "" 0 . .P -Where \'{HEX}\' is a hexidecimal number (\'0\-9a\-f\')\. The \'{INTEGER}\' value can be between 0 and 255, the \'{Real}\' value between 0\.0 and 1\.0\. +The in CSS 4 proposed white\-space format is also supported\. . .P -The first formats specify the color as RRGGBB (R = red, G = green, B = Blue), the second adds an alpha (A) channel: AARRGGBB\. +The different values are: +. +.IP "\(bu" 4 +\fB{HEX}\fR is a hexidecimal number (\'0\-9a\-f\' case insensitive)\. +. +.IP "\(bu" 4 +\fB{INTEGER}\fR value can be between 0 and 255 or 0\-100 when representing percentage\. +. +.IP "\(bu" 4 +\fB{ANGLE}\fR Angle on the color wheel, can be in \fBdeg\fR, \fBrad\fR, \fBgrad\fR or \fBturn\fR\. When no unit is specified, degrees is assumed\. +. +.IP "\(bu" 4 +\fB{PERCENTAGE}\fR Can be between 0\-1\.0, or 0%\-100% +. +.IP "\(bu" 4 +\fB{named\-color}\fR Is one of the following colors: +. +.IP +AliceBlue, AntiqueWhite, Aqua, Aquamarine, Azure, Beige, Bisque, Black, BlanchedAlmond, Blue, BlueViolet, Brown, BurlyWood, CadetBlue, Chartreuse, Chocolate, Coral, CornflowerBlue, Cornsilk, Crimson, Cyan, DarkBlue, DarkCyan, DarkGoldenRod, DarkGray, DarkGrey, DarkGreen, DarkKhaki, DarkMagenta, DarkOliveGreen, DarkOrange, DarkOrchid, DarkRed, DarkSalmon, DarkSeaGreen, DarkSlateBlue, DarkSlateGray, DarkSlateGrey, DarkTurquoise, DarkViolet, DeepPink, DeepSkyBlue, DimGray, DimGrey, DodgerBlue, FireBrick, FloralWhite, ForestGreen, Fuchsia, Gainsboro, GhostWhite, Gold, GoldenRod, Gray, Grey, Green, GreenYellow, HoneyDew, HotPink, IndianRed, Indigo, Ivory, Khaki, Lavender, LavenderBlush, LawnGreen, LemonChiffon, LightBlue, LightCoral, LightCyan, LightGoldenRodYellow, LightGray, LightGrey, LightGreen, LightPink, LightSalmon, LightSeaGreen, LightSkyBlue, LightSlateGray, LightSlateGrey, LightSteelBlue, LightYellow, Lime, LimeGreen, Linen, Magenta, Maroon, MediumAquaMarine, MediumBlue, MediumOrchid, MediumPurple, MediumSeaGreen, MediumSlateBlue, MediumSpringGreen, MediumTurquoise, MediumVioletRed, MidnightBlue, MintCream, MistyRose, Moccasin, NavajoWhite, Navy, OldLace, Olive, OliveDrab, Orange, OrangeRed, Orchid, PaleGoldenRod, PaleGreen, PaleTurquoise, PaleVioletRed, PapayaWhip, PeachPuff, Peru, Pink, Plum, PowderBlue, Purple, RebeccaPurple, Red, RosyBrown, RoyalBlue, SaddleBrown, Salmon, SandyBrown, SeaGreen, SeaShell, Sienna, Silver, SkyBlue, SlateBlue, SlateGray, SlateGrey, Snow, SpringGreen, SteelBlue, Tan, Teal, Thistle, Tomato, Turquoise, Violet, Wheat, White, WhiteSmoke, Yellow, YellowGreen +. +.IP "" 0 . .P For example: @@ -390,6 +429,7 @@ For example: background: #FF0000; foreground: rgba(0,0,1, 0\.5); +text: SeaGreen; . .fi . @@ -398,12 +438,29 @@ foreground: rgba(0,0,1, 0\.5); .SH "Text style" . .IP "\(bu" 4 -Format: \fB(bold|italic|underline|none)\fR +Format: \fB(bold|italic|underline|strikethrough|none)\fR . .IP "" 0 . .P -Text style indicates how the text should be displayed\. None indicates no style should be applied\. +Text style indicates how the highlighted text is emphasised\. None indicates no emphasis should be applied\. +. +.IP "\(bu" 4 +\fBbold\fR: make the text thicker then the surrounding text\. +. +.IP "\(bu" 4 +\fBitalic\fR: put the highlighted text in script type (slanted)\. +. +.IP "\(bu" 4 +\fBunderline\fR: put a line under the highlighted text\. +. +.IP "\(bu" 4 +\fBstrikethrough\fR: put a line through the highlighted text\. +. +.IP "\(bu" 4 +\fBsmall caps\fR: emphasise the text using capitalization\. +. +.IP "" 0 . .SH "Line style" . diff --git a/include/css-colors.h b/include/css-colors.h new file mode 100644 index 00000000..0c47b393 --- /dev/null +++ b/include/css-colors.h @@ -0,0 +1,12 @@ +#ifndef ROFI_INCLUDE_CSS_COLORS_H +#define ROFI_INCLUDE_CSS_COLORS_H + +typedef struct CSSColor +{ + char *name; + uint8_t b, g, r, a; +}CSSColor; + +extern const CSSColor CSSColors[]; +extern const unsigned int num_CSSColors; +#endif // ROFI_INCLUDE_CSS_COLORS_H diff --git a/include/default-theme.h b/include/default-theme.h index 8ae52a6c..43af69e0 100644 --- a/include/default-theme.h +++ b/include/default-theme.h @@ -31,14 +31,14 @@ const char *default_theme = "* {" " spacing: 2;" - " background: #FFFDF6E3;" - " foreground: #FF002B36;" + " background: #FDF6E3FF;" + " foreground: #002B36FF;" " bordercolor: @foreground;" " separatorcolor: @foreground;" - " red: #FFDC322F;" - " blue: #FF268BD2;" - " lightbg: #FFEEE8D5;" - " lightfg: #FF586875;" + " red: #DC322FFF;" + " blue: #268BD2FF;" + " lightbg: #EEE8D5FF;" + " lightfg: #586875FF;" " normal-foreground: @foreground;" " normal-background: @background;" " urgent-foreground: @red;" @@ -83,7 +83,6 @@ const char *default_theme = "#window.mainbox.listview {" " fixed-height: 0;" " border: 1px dash 0px 0px ;" - " columns: 1;" " padding: 2px 0px 0px ;" "}" "#window.mainbox.listview.element {" @@ -132,6 +131,10 @@ const char *default_theme = "#window.mainbox.sidebar.box {" " border: 1px dash 0px 0px ;" "}" + "#window.mainbox.sidebar button selected {" + " background: @selected-normal-background;" + " foreground: @selected-normal-foreground;" + "}" "#window.mainbox.inputbar {" " spacing: 0;" "}" diff --git a/include/helper.h b/include/helper.h index e3648b6b..03d4515f 100644 --- a/include/helper.h +++ b/include/helper.h @@ -244,7 +244,7 @@ int rofi_scorer_fuzzy_evaluate ( const char *pattern, glong plen, const char *st * are found, respectively, to be less than, to match, or be greater than the first `n` * characters (not bytes) of `b`. */ -int utf8_strncmp ( const char *a, const char* b, size_t n ) __attribute__((nonnull(1,2))); +int utf8_strncmp ( const char *a, const char* b, size_t n ) __attribute__( ( nonnull ( 1, 2 ) ) ); /** * @param wd The work directory (optional) diff --git a/include/settings.h b/include/settings.h index 572ebd6b..f18be7a9 100644 --- a/include/settings.h +++ b/include/settings.h @@ -56,22 +56,22 @@ typedef enum { /** Center */ WL_CENTER = 0, - /** Left top corner. */ - WL_NORTH_WEST = 1, /** Top middle */ - WL_NORTH = 2, - /** Top right */ - WL_NORTH_EAST = 3, + WL_NORTH = 1, /** Middle right */ - WL_EAST = 4, - /** Bottom right */ - WL_SOUTH_EAST = 5, + WL_EAST = 2, /** Bottom middle */ - WL_SOUTH = 6, - /** Bottom left */ - WL_SOUTH_WEST = 7, + WL_SOUTH = 4, /** Middle left */ - WL_WEST = 8 + WL_WEST = 8, + /** Left top corner. */ + WL_NORTH_WEST = WL_NORTH | WL_WEST, + /** Top right */ + WL_NORTH_EAST = WL_NORTH | WL_EAST, + /** Bottom right */ + WL_SOUTH_EAST = WL_SOUTH | WL_EAST, + /** Bottom left */ + WL_SOUTH_WEST = WL_SOUTH | WL_WEST, } WindowLocation; /** diff --git a/include/theme.h b/include/theme.h index 16d03c1d..8bdeddc1 100644 --- a/include/theme.h +++ b/include/theme.h @@ -42,6 +42,10 @@ typedef enum HL_BOLD = 1, /** underline */ HL_UNDERLINE = 2, + /** strikethrough */ + HL_STRIKETHROUGH = 16, + /** small caps */ + HL_SMALL_CAPS = 32, /** italic */ HL_ITALIC = 4, /** color */ diff --git a/include/widgets/textbox.h b/include/widgets/textbox.h index b25b4c02..fc75baa7 100644 --- a/include/widgets/textbox.h +++ b/include/widgets/textbox.h @@ -290,5 +290,6 @@ PangoAttrList *textbox_get_pango_attributes ( textbox *tb ); * @returns the visible text. */ const char *textbox_get_visible_text ( const textbox *tb ); +int textbox_get_desired_width ( widget *wid ); /*@}*/ #endif //ROFI_TEXTBOX_H diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index 8d7e5718..80ee6584 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -36,10 +36,13 @@ #include #include #include +#include +#include #include "rofi.h" #include "theme.h" #include "theme-parser.h" +#include "css-colors.h" #define LOG_DOMAIN "Parser" int last_state = 0; @@ -82,6 +85,21 @@ GQueue *queue = NULL; ParseObject *current = NULL; static char * rofi_theme_parse_prepare_file ( const char *file, const char *parent_file ); + + +static double rofi_theme_parse_convert_hex ( char high, char low) +{ + uint8_t retv = 0; + + int t = toupper(high); + t = ( t > '9')? (t-'A'+10):(t-'0'); + retv = t<<4; + t = toupper ( low ); + t = ( t > '9')? (t-'A'+10):(t-'0'); + retv +=t; + return retv/255.0; +} + %} %{ @@ -144,7 +162,9 @@ UANYN {ASCN}|{U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} // UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} WHITESPACE [[:blank:]] +WSO [[:blank:]]* WORD [[:alnum:]-]+ +COLOR_NAME [[:alpha:]]+ STRING {UANYN}+ HEX [[:xdigit:]] NUMBER [[:digit:]] @@ -156,16 +176,40 @@ PERCENT (\%) ASTERIX \* + /* Position */ CENTER "center" NORTH "north" SOUTH "south" EAST "east" WEST "west" -NONE "none" -BOLD "bold" -UNDERLINE "underline" -ITALIC "italic" + /* Line Style */ +NONE "none" +BOLD "bold" +UNDERLINE "underline" +ITALIC "italic" +STRIKETHROUGH "strikethrough" +SMALLCAPS "small caps" + +/* ANGLES */ + +ANGLE_DEG "deg" +ANGLE_GRAD "grad" +ANGLE_RAD "rad" +ANGLE_TURN "turn" + + /* Color schema */ +RGBA rgb[a]? +HWB "hwb" +CMYK "cmyk" +HSL hsl[a]? + +COLOR_TRANSPARENT "transparent" + +S_T_PARENT_LEFT \( +S_T_PARENT_RIGHT \) +COMMA , +FORWARD_SLASH \/ LS_DASH "dash" LS_SOLID "solid" @@ -298,218 +342,149 @@ if ( queue == NULL ){ {CONFIGURATION} { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(DEFAULTS); - return CONFIGURATION; + return T_CONFIGURATION; } {ASTERIX} { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(DEFAULTS); - return PDEFAULTS; + return T_PDEFAULTS; } /** Skip all whitespace */ {WHITESPACE} {} "\{" { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(SECTION); - return BOPEN; + return T_BOPEN; } /** Everythin not yet parsed is an error. */ . { return T_ERROR_DEFAULTS; } -"#" { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(NAMESTR);return NAME_PREFIX;} +"#" { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(NAMESTR);return T_NAME_PREFIX;} /* Go into parsing an section*/ "\{" { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(SECTION); - return BOPEN; + return T_BOPEN; } /* Pop out of parsing an section. */
"\}" { g_queue_pop_head ( queue ); BEGIN(GPOINTER_TO_INT(g_queue_pop_head ( queue ))); - return BCLOSE; + return T_BCLOSE; } -\.|{WHITESPACE} { return NSEP; } -
{WORD} { yylval->sval = g_strdup(yytext); return N_STRING;} -{WORD} { yylval->sval = g_strdup(yytext); return NAME_ELEMENT;} +\.|{WHITESPACE} { return T_NSEP; } +
{WORD} { yylval->sval = g_strdup(yytext); return T_PROP_NAME;} +{WORD} { yylval->sval = g_strdup(yytext); return T_NAME_ELEMENT;} /* After Namestr/Classstr we want to go to state str, then to { */ {WHITESPACE}+ ; // ignore all whitespace {WHITESPACE}+ ; // ignore all whitespace -
":" { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(PROPERTIES); return PSEP; } -";" { BEGIN(GPOINTER_TO_INT ( g_queue_pop_head ( queue ))); return PCLOSE;} -(true|false) { yylval->bval= g_strcmp0(yytext, "true") == 0; return T_BOOLEAN;} -{PNNUMBER} { yylval->ival = (int)g_ascii_strtoll(yytext, NULL, 10); return T_INT;} +
":" { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(PROPERTIES); return T_PSEP; } +";" { BEGIN(GPOINTER_TO_INT ( g_queue_pop_head ( queue ))); return T_PCLOSE;} +(true|false) { yylval->bval= g_strcmp0(yytext, "true") == 0; return T_BOOLEAN;} {PNNUMBER}\.{NUMBER}+ { yylval->fval = g_ascii_strtod(yytext, NULL); return T_DOUBLE;} -\"{STRING}\" { yytext[yyleng-1] = '\0'; yylval->sval = g_strdup(&yytext[1]); return T_STRING;} -@{WORD} { +{PNNUMBER} { yylval->ival = (int)g_ascii_strtoll(yytext, NULL, 10); return T_INT;} +\"{STRING}\" { yytext[yyleng-1] = '\0'; yylval->sval = g_strdup(&yytext[1]); return T_STRING;} +@{WORD} { yylval->sval = g_strdup(yytext); return T_LINK; } -{REAL}{EM} { - yylval->distance.distance = (double)g_ascii_strtod(yytext, NULL); - yylval->distance.type = PW_EM; - yylval->distance.style = SOLID; - return T_PIXEL; -} -{PNNUMBER}{PX} { - yylval->distance.distance = (double)g_ascii_strtoll(yytext, NULL, 10); - yylval->distance.type = PW_PX; - yylval->distance.style = SOLID; - return T_PIXEL; -} -{PNNUMBER}{PX}{WHITESPACE}{LS_DASH} { - yylval->distance.distance = (double)g_ascii_strtoll(yytext, NULL, 10); - yylval->distance.type = PW_PX; - yylval->distance.style = DASH; - return T_PIXEL; -} -{REAL}{EM}{WHITESPACE}{LS_DASH} { - yylval->distance.distance = (double)g_ascii_strtod(yytext, NULL); - yylval->distance.type = PW_EM; - yylval->distance.style = DASH; - return T_PIXEL; -} -{PNNUMBER}{PX}{WHITESPACE}{LS_SOLID} { - yylval->distance.distance = (double)g_ascii_strtoll(yytext, NULL, 10); - yylval->distance.type = PW_PX; - yylval->distance.style = SOLID; - return T_PIXEL; -} -{REAL}{EM}{WHITESPACE}{LS_SOLID} { - yylval->distance.distance = (double)g_ascii_strtod(yytext, NULL); - yylval->distance.type = PW_EM; - yylval->distance.style = SOLID; - return T_PIXEL; -} -{REAL}{PERCENT} { - yylval->distance.distance = (double)g_ascii_strtod(yytext, NULL); - yylval->distance.type = PW_PERCENT; - yylval->distance.style = SOLID; - return T_PIXEL; -} -{REAL}{PERCENT}{WHITESPACE}{LS_SOLID} { - yylval->distance.distance = (double)g_ascii_strtod(yytext, NULL); - yylval->distance.type = PW_PERCENT; - yylval->distance.style = SOLID; - return T_PIXEL; -} -{REAL}{PERCENT}{WHITESPACE}{LS_DASH} { - yylval->distance.distance = (double)g_ascii_strtod(yytext, NULL); - yylval->distance.type = PW_PERCENT; - yylval->distance.style = DASH; - return T_PIXEL; -} +{EM} { return T_UNIT_EM; } +{PX} { return T_UNIT_PX; } +{PERCENT} { return T_PERCENT; } +{LS_SOLID} { return T_SOLID; } +{LS_DASH} { return T_DASH; } + + /** + * Color parsing. It is easier to do this at lexer level. + * Other schemes are done at yacc level. + */ #{HEX}{8} { - union { unsigned int val; struct { unsigned char b,g,r,a;};} val; - val.val = (unsigned int)strtoull ( &yytext[1], NULL, 16); - yylval->colorval.alpha = val.a/255.0; - yylval->colorval.red = val.r/255.0; - yylval->colorval.green = val.g/255.0; - yylval->colorval.blue = val.b/255.0; + yylval->colorval.red = rofi_theme_parse_convert_hex(yytext[1],yytext[2]); + yylval->colorval.green = rofi_theme_parse_convert_hex(yytext[3],yytext[4]); + yylval->colorval.blue = rofi_theme_parse_convert_hex(yytext[5],yytext[6]); + yylval->colorval.alpha = rofi_theme_parse_convert_hex(yytext[7],yytext[8]); return T_COLOR; } #{HEX}{6} { - union { unsigned int val; struct { unsigned char b,g,r,a;};} val; - val.val = (unsigned int)g_ascii_strtoull ( &yytext[1], NULL, 16); yylval->colorval.alpha = 1.0; - yylval->colorval.red = val.r/255.0; - yylval->colorval.green = val.g/255.0; - yylval->colorval.blue = val.b/255.0; + yylval->colorval.red = rofi_theme_parse_convert_hex(yytext[1],yytext[2]); + yylval->colorval.green = rofi_theme_parse_convert_hex(yytext[3],yytext[4]); + yylval->colorval.blue = rofi_theme_parse_convert_hex(yytext[5],yytext[6]); return T_COLOR; } #{HEX}{3} { - union { uint16_t val; struct { unsigned char b:4,g:4,r:4,a :4;};} val; - val.val = (uint16_t )g_ascii_strtoull ( &yytext[1], NULL, 16); yylval->colorval.alpha = 1.0; - yylval->colorval.red = val.r/15.0; - yylval->colorval.green = val.g/15.0; - yylval->colorval.blue = val.b/15.0; + yylval->colorval.red = rofi_theme_parse_convert_hex(yytext[1],yytext[1]); + yylval->colorval.green = rofi_theme_parse_convert_hex(yytext[2],yytext[2]); + yylval->colorval.blue = rofi_theme_parse_convert_hex(yytext[3],yytext[3]); return T_COLOR; } -rgba\({NUMBER}{1,3},{NUMBER}{1,3},{NUMBER}{1,3},[01](\.{NUMBER}+)?\) { - char *endptr = &yytext[5]; - yylval->colorval.red = g_ascii_strtoull ( endptr, &endptr, 10)/255.0; - yylval->colorval.green= g_ascii_strtoull ( endptr+1, &endptr, 10)/255.0; - yylval->colorval.blue= g_ascii_strtoull ( endptr+1, &endptr, 10)/255.0; - yylval->colorval.alpha= g_ascii_strtod ( endptr+1, NULL); +#{HEX}{4} { + yylval->colorval.alpha = rofi_theme_parse_convert_hex(yytext[4],yytext[4]); + yylval->colorval.red = rofi_theme_parse_convert_hex(yytext[1],yytext[1]); + yylval->colorval.green = rofi_theme_parse_convert_hex(yytext[2],yytext[2]); + yylval->colorval.blue = rofi_theme_parse_convert_hex(yytext[3],yytext[3]); return T_COLOR; } -rgb\({NUMBER}{1,3},{NUMBER}{1,3},{NUMBER}{1,3}\) { - char *endptr = &yytext[4]; - yylval->colorval.red = g_ascii_strtoull ( endptr, &endptr, 10)/255.0; - yylval->colorval.green = g_ascii_strtoull ( endptr+1, &endptr, 10)/255.0; - yylval->colorval.blue = g_ascii_strtoull ( endptr+1, &endptr, 10)/255.0; - yylval->colorval.alpha = 1.0; +argb:{HEX}{8} { + yylval->colorval.alpha = rofi_theme_parse_convert_hex(yytext[5],yytext[6]); + yylval->colorval.red = rofi_theme_parse_convert_hex(yytext[7],yytext[8]); + yylval->colorval.green = rofi_theme_parse_convert_hex(yytext[9],yytext[10]); + yylval->colorval.blue = rofi_theme_parse_convert_hex(yytext[11],yytext[12]); return T_COLOR; } -argb:{HEX}{1,8} { - union { unsigned int val; struct { unsigned char b,g,r,a;};} val; - val.val = (unsigned int)strtoull ( &yytext[5], NULL, 16); - yylval->colorval.alpha = val.a/255.0; - yylval->colorval.red = val.r/255.0; - yylval->colorval.green = val.g/255.0; - yylval->colorval.blue = val.b/255.0; - return T_COLOR; + /* Color schemes */ +{RGBA} { return T_COL_RGBA; } +{HSL} { return T_COL_HSL; } +{HWB} { return T_COL_HWB; } +{CMYK} { return T_COL_CMYK; } + /* Fluff */ +{S_T_PARENT_LEFT} { return T_PARENT_LEFT; } +{S_T_PARENT_RIGHT} { return T_PARENT_RIGHT; } +{COMMA} { return T_COMMA; } +{FORWARD_SLASH} { return T_FORWARD_SLASH; } + /* Position */ +{CENTER} { return T_POS_CENTER; } +{EAST} { return T_POS_EAST; } +{WEST} { return T_POS_WEST; } +{SOUTH} { return T_POS_SOUTH; } +{NORTH} { return T_POS_NORTH; } + /* Highlight style */ +{NONE} { return T_NONE; } +{BOLD} { return T_BOLD; } +{ITALIC} { return T_ITALIC; } +{UNDERLINE} { return T_UNDERLINE; } +{STRIKETHROUGH} { return T_STRIKETHROUGH; } +{SMALLCAPS} { return T_SMALLCAPS; } + +{ANGLE_DEG} { return T_ANGLE_DEG; } +{ANGLE_RAD} { return T_ANGLE_RAD; } +{ANGLE_GRAD} { return T_ANGLE_GRAD; } +{ANGLE_TURN} { return T_ANGLE_TURN; } + +{COLOR_TRANSPARENT} { + return T_COLOR_TRANSPARENT; +} +{COLOR_NAME} { + for ( unsigned int iter = 0; iter < num_CSSColors; iter++){ + if ( strcasecmp(yytext, CSSColors[iter].name )== 0 ) { + yylval->colorval.alpha = 1.0; + yylval->colorval.red = CSSColors[iter].r/255.0; + yylval->colorval.green = CSSColors[iter].g/255.0; + yylval->colorval.blue = CSSColors[iter].b/255.0; + return T_COLOR_NAME; + } + } + REJECT; } -{CENTER} { - yylval->ival = WL_CENTER; - return T_POSITION; -} -{EAST} { - yylval->ival = WL_EAST; - return T_POSITION; -} -{WEST} { - yylval->ival = WL_WEST; - return T_POSITION; -} -{SOUTH}{EAST} { - yylval->ival = WL_SOUTH_EAST; - return T_POSITION; -} -{SOUTH}{WEST} { - yylval->ival = WL_SOUTH_WEST; - return T_POSITION; -} -{SOUTH} { - yylval->ival = WL_SOUTH; - return T_POSITION; -} -{NORTH}{EAST} { - yylval->ival = WL_NORTH_EAST; - return T_POSITION; -} -{NORTH}{WEST} { - yylval->ival = WL_NORTH_WEST; - return T_POSITION; -} -{NORTH} { - yylval->ival = WL_NORTH; - return T_POSITION; -} -{NONE} { - yylval->ival = HL_NONE; - return T_HIGHLIGHT_STYLE; -} -{BOLD} { - yylval->ival = HL_BOLD; - return T_HIGHLIGHT_STYLE; -} -{ITALIC} { - yylval->ival = HL_ITALIC; - return T_HIGHLIGHT_STYLE; -} -{UNDERLINE} { - yylval->ival = HL_UNDERLINE; - return T_HIGHLIGHT_STYLE; -} <> { ParseObject *po = g_queue_pop_head ( file_queue ); if ( po ) { diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index 99f47ccc..d66b7cc4 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -35,6 +35,7 @@ %code requires { #include "theme.h" #include "xrmoptions.h" +#include "css-colors.h" typedef struct YYLTYPE { int first_line; @@ -74,6 +75,62 @@ typedef struct YYLTYPE { ThemeWidget *rofi_theme = NULL; void yyerror(YYLTYPE *yylloc, const char *what, const char* s); int yylex (YYSTYPE *, YYLTYPE *); + + +static int check_in_range ( double index, double low, double high, YYLTYPE *loc ) +{ + if ( index > high || index < low ){ + gchar *str = g_strdup_printf("Value out of range: \n\t\tValue: X = %.2lf;\n\t\tRange: %.2lf <= X <= %.2lf.", index, low, high ); + yyerror ( loc, loc->filename, str); + g_free(str); + return FALSE; + } + + return TRUE; +} + +static double hue2rgb(double p, double q, double t){ + t += (t<0)?1.0:0.0; + t -= (t>1)?1.0:0.0; + if( t < (1/6.0) ) { + return p + (q - p) * 6 * t; + } + if( t < (1/2.0) ) { + return q; + } + if( t < (2/3.0) ) { + return p + (q - p) * (2/3.0 - t) * 6; + } + return p; +} +static ThemeColor hsl_to_rgb ( double h, double s, double l ) +{ + ThemeColor colour; + + if(s < 0.001 && s > -0.001){ + colour.red = colour.green = colour.blue = l; // achromatic + }else{ + + double q = l < 0.5 ? l * (1 + s) : l + s - l * s; + double p = 2 * l - q; + colour.red = hue2rgb(p, q, h + 1/3.0); + colour.green = hue2rgb(p, q, h); + colour.blue = hue2rgb(p, q, h - 1/3.0); + } + + return colour; +} +static ThemeColor hwb_to_rgb ( double h, double w, double b) +{ + ThemeColor retv = hsl_to_rgb ( h, 1.0, 0.5); + retv.red *= ( 1. - w - b ); + retv.red += w; + retv.green *= ( 1. - w - b ); + retv.green += w; + retv.blue *= ( 1. - w - b ); + retv.blue += w; + return retv; +} %} %union { @@ -81,6 +138,7 @@ int yylex (YYSTYPE *, YYLTYPE *); double fval; char *sval; int bval; + WindowLocation wloc; ThemeColor colorval; ThemeWidget *theme; GList *name_path; @@ -96,42 +154,89 @@ int yylex (YYSTYPE *, YYLTYPE *); %token T_ERROR_NAMESTRING 4 "invalid element name" %token T_ERROR_DEFAULTS 5 "invalid defaults name" %token T_ERROR_INCLUDE 6 "invalid import value" -%token T_INT -%token T_DOUBLE -%token T_STRING -%token N_STRING "property name" -%token T_POSITION; -%token T_HIGHLIGHT_STYLE -%token NAME_ELEMENT "Element name" -%token T_BOOLEAN -%token T_COLOR -%token T_PIXEL -%token T_LINK -%token FIRST_NAME +%token T_INT "Integer number" +%token T_DOUBLE "Floating-point number" +%token T_STRING "UTF-8 encoded string" +%token T_PROP_NAME "property name" +%token T_COLOR_NAME "Color value by name" +%token T_NAME_ELEMENT "Element name" +%token T_BOOLEAN "Boolean value (true or false)" +%token T_COLOR "Hexidecimal color value" +%token T_LINK "Reference" +%token T_POS_CENTER "Center" +%token T_POS_EAST "East" +%token T_POS_WEST "West" +%token T_POS_NORTH "North" +%token T_POS_SOUTH "South" -%token BOPEN "bracket open ('{')" -%token BCLOSE "bracket close ('}')" -%token PSEP "property separator (':')" -%token PCLOSE "property close (';')" -%token NSEP "Name separator (' ' or '.')" -%token NAME_PREFIX "Element section ('# {name} { ... }')" -%token WHITESPACE "White space" -%token PDEFAULTS "Default settings section ( '* { ... }')" -%token CONFIGURATION "Configuration block" +%token T_NONE "None" +%token T_BOLD "Bold" +%token T_ITALIC "Italic" +%token T_UNDERLINE "Underline" +%token T_STRIKETHROUGH "Strikethrough" +%token T_SMALLCAPS "Small CAPS" +%token T_DASH "Dash" +%token T_SOLID "Solid" -%type highlight_styles -%type entry -%type pvalue -%type entries -%type name_path -%type property -%type property_list -%type optional_properties -%start entries +%token T_UNIT_PX "pixels" +%token T_UNIT_EM "em" +%token T_UNIT_PERCENT "%" + +%token T_ANGLE_DEG "Degrees" +%token T_ANGLE_GRAD "Gradians" +%token T_ANGLE_RAD "Radians" +%token T_ANGLE_TURN "Turns" + +%token T_COL_RGBA "rgb[a] colorscheme" +%token T_COL_HSL "hsl colorscheme" +%token T_COL_HWB "hwb colorscheme" +%token T_COL_CMYK "cmyk colorscheme" + +%token T_PARENT_LEFT "Parent left ('(')" +%token T_PARENT_RIGHT "Parent right (')')" +%token T_COMMA "comma separator (',')" +%token T_OPTIONAL_COMMA "Optional comma separator (',')" +%token T_FORWARD_SLASH "forward slash ('/')" +%token T_PERCENT "Percent sign ('%')" + +%token T_BOPEN "bracket open ('{')" +%token T_BCLOSE "bracket close ('}')" +%token T_PSEP "property separator (':')" +%token T_PCLOSE "property close (';')" +%token T_NSEP "Name separator (' ' or '.')" +%token T_NAME_PREFIX "Element section ('# {name} { ... }')" +%token T_WHITESPACE "White space" +%token T_PDEFAULTS "Default settings section ( '* { ... }')" +%token T_CONFIGURATION "Configuration block" + +%token T_COLOR_TRANSPARENT "Transparent" + +%type t_entry +%type t_entry_list +%type t_entry_name_path +%type t_property +%type t_property_list +%type t_property_list_optional +%type t_property_color +%type t_property_color_value +%type t_property_color_opt_alpha_c +%type t_property_color_opt_alpha_ws +%type t_property_color_value_unit +%type t_property_color_value_angle +%type t_property_name +%type t_property_distance +%type t_property_unit +%type t_property_position +%type t_property_position_ew +%type t_property_position_sn +%type t_property_highlight_styles +%type t_property_highlight_style +%type t_property_line_style +%start t_entry_list %% -entries: +t_entry_list: %empty { // There is always a base widget. if (rofi_theme == NULL ){ @@ -139,13 +244,13 @@ entries: rofi_theme->name = g_strdup ( "Root" ); } } -| entries - entry { +| t_entry_list + t_entry { } ; -entry: -NAME_PREFIX name_path BOPEN optional_properties BCLOSE +t_entry: +T_NAME_PREFIX t_entry_name_path T_BOPEN t_property_list_optional T_BCLOSE { ThemeWidget *widget = rofi_theme; for ( GList *iter = g_list_first ( $2 ); iter ; iter = g_list_next ( iter ) ) { @@ -157,10 +262,10 @@ NAME_PREFIX name_path BOPEN optional_properties BCLOSE rofi_theme_widget_add_properties ( widget, $4); } | - PDEFAULTS BOPEN optional_properties BCLOSE { + T_PDEFAULTS T_BOPEN t_property_list_optional T_BCLOSE { rofi_theme_widget_add_properties ( rofi_theme, $3); } -| CONFIGURATION BOPEN optional_properties BCLOSE { +| T_CONFIGURATION T_BOPEN t_property_list_optional T_BCLOSE { GHashTableIter iter; g_hash_table_iter_init ( &iter, $3 ); gpointer key,value; @@ -175,103 +280,287 @@ NAME_PREFIX name_path BOPEN optional_properties BCLOSE /** * properties */ -optional_properties +t_property_list_optional : %empty { $$ = NULL; } - | property_list { $$ = $1; } + | t_property_list { $$ = $1; } ; -property_list: - property { +t_property_list: + t_property { $$ = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, (GDestroyNotify)rofi_theme_property_free ); g_hash_table_replace ( $$, $1->name, $1 ); } -| property_list property { +| t_property_list t_property { // Old will be free'ed, and key/value will be replaced. g_hash_table_replace ( $$, $2->name, $2 ); } ; -property -: pvalue PSEP T_INT PCLOSE { +t_property +: t_property_name T_PSEP T_INT T_PCLOSE { $$ = rofi_theme_property_create ( P_INTEGER ); $$->name = $1; $$->value.i = $3; } -| pvalue PSEP T_DOUBLE PCLOSE { +| t_property_name T_PSEP T_DOUBLE T_PCLOSE { $$ = rofi_theme_property_create ( P_DOUBLE ); $$->name = $1; $$->value.f = $3; } -| pvalue PSEP T_COLOR PCLOSE { - $$ = rofi_theme_property_create ( P_COLOR ); - $$->name = $1; - $$->value.color = $3; - } -| pvalue PSEP T_STRING PCLOSE { +| t_property_name T_PSEP T_STRING T_PCLOSE { $$ = rofi_theme_property_create ( P_STRING ); $$->name = $1; $$->value.s = $3; } -| pvalue PSEP T_LINK PCLOSE { +| t_property_name T_PSEP T_LINK T_PCLOSE { $$ = rofi_theme_property_create ( P_LINK ); $$->name = $1; $$->value.link.name = $3; } -| pvalue PSEP T_BOOLEAN PCLOSE { +| t_property_name T_PSEP T_BOOLEAN T_PCLOSE { $$ = rofi_theme_property_create ( P_BOOLEAN ); $$->name = $1; $$->value.b = $3; } -| pvalue PSEP T_PIXEL PCLOSE { +| t_property_name T_PSEP t_property_distance T_PCLOSE { $$ = rofi_theme_property_create ( P_PADDING ); $$->name = $1; $$->value.padding = (Padding){ $3, $3, $3, $3 }; } -| pvalue PSEP T_PIXEL T_PIXEL PCLOSE { +| t_property_name T_PSEP t_property_distance t_property_distance T_PCLOSE { $$ = rofi_theme_property_create ( P_PADDING ); $$->name = $1; $$->value.padding = (Padding){ $3, $4, $3, $4 }; } -| pvalue PSEP T_PIXEL T_PIXEL T_PIXEL PCLOSE { +| t_property_name T_PSEP t_property_distance t_property_distance t_property_distance T_PCLOSE { $$ = rofi_theme_property_create ( P_PADDING ); $$->name = $1; $$->value.padding = (Padding){ $3, $4, $5, $4 }; } -| pvalue PSEP T_PIXEL T_PIXEL T_PIXEL T_PIXEL PCLOSE { +| t_property_name T_PSEP t_property_distance t_property_distance t_property_distance t_property_distance T_PCLOSE { $$ = rofi_theme_property_create ( P_PADDING ); $$->name = $1; $$->value.padding = (Padding){ $3, $4, $5, $6 }; } -| pvalue PSEP T_POSITION PCLOSE{ +| t_property_name T_PSEP t_property_position T_PCLOSE{ $$ = rofi_theme_property_create ( P_POSITION ); $$->name = $1; $$->value.i = $3; } -| pvalue PSEP highlight_styles T_COLOR PCLOSE { +| t_property_name T_PSEP t_property_highlight_styles t_property_color T_PCLOSE { $$ = rofi_theme_property_create ( P_HIGHLIGHT ); $$->name = $1; $$->value.highlight.style = $3|HL_COLOR; $$->value.highlight.color = $4; } -| pvalue PSEP highlight_styles PCLOSE { +| t_property_name T_PSEP t_property_highlight_styles T_PCLOSE { $$ = rofi_theme_property_create ( P_HIGHLIGHT ); $$->name = $1; $$->value.highlight.style = $3; } -; - -highlight_styles: - T_HIGHLIGHT_STYLE { $$ = $1; } -| highlight_styles T_HIGHLIGHT_STYLE { - $$ = $1 | $2; +| t_property_name T_PSEP t_property_color T_PCLOSE { + $$ = rofi_theme_property_create ( P_COLOR ); + $$->name = $1; + $$->value.color = $3; } ; -pvalue: N_STRING { $$ = $1; } -name_path: -NAME_ELEMENT { $$ = g_list_append ( NULL, $1 );} -| name_path NSEP NAME_ELEMENT { $$ = g_list_append ( $1, $3);} -| name_path NSEP { $$ = $1; } +/** + * Position can be either center, + * East or West, North Or South + * Or combi of East or West and North or South + */ +t_property_position +: T_POS_CENTER { $$ =WL_CENTER;} +| t_property_position_ew +| t_property_position_sn +| t_property_position_ew t_property_position_sn { $$ = $1|$2;} +| t_property_position_sn t_property_position_ew { $$ = $1|$2;} +; +t_property_position_ew +: T_POS_EAST { $$ = WL_EAST;} +| T_POS_WEST { $$ = WL_WEST;} +; +t_property_position_sn +: T_POS_NORTH { $$ = WL_NORTH;} +| T_POS_SOUTH { $$ = WL_SOUTH;} +; + +/** + * Highlight style, allow mulitple styles to be combined. + * Empty not allowed + */ +t_property_highlight_styles +: t_property_highlight_style { $$ = $1;} +| t_property_highlight_styles t_property_highlight_style { $$ = $1|$2;} +; +/** Single style. */ +t_property_highlight_style +: T_NONE { $$ = HL_NONE; } +| T_BOLD { $$ = HL_BOLD; } +| T_UNDERLINE { $$ = HL_UNDERLINE; } +| T_STRIKETHROUGH { $$ = HL_STRIKETHROUGH; } +| T_ITALIC { $$ = HL_ITALIC; } +| T_SMALLCAPS { $$ = HL_SMALL_CAPS; } +; + +/** Distance. */ +t_property_distance +/** Interger unit and line style */ +: T_INT t_property_unit t_property_line_style { + $$.distance = (double)$1; + $$.type = $2; + $$.style = $3; +} +/** Double unit and line style */ +| T_DOUBLE t_property_unit t_property_line_style { + $$.distance = (double)$1; + $$.type = $2; + $$.style = $3; +}; + +/** distance unit. px, em, % */ +t_property_unit +: T_UNIT_PX { $$ = PW_PX; } +| T_UNIT_EM { $$ = PW_EM; } +| T_PERCENT { $$ = PW_PERCENT; } +; +/****** + * Line style + * If not set, solid. + */ +t_property_line_style +: %empty { $$ = SOLID; } +| T_SOLID { $$ = SOLID; } +| T_DASH { $$ = DASH; } +; + +/** + * Color formats + */ +t_property_color + /** rgba ( 0-255 , 0-255, 0-255, 0-1.0 ) */ +: T_COL_RGBA T_PARENT_LEFT T_INT T_COMMA T_INT T_COMMA T_INT t_property_color_opt_alpha_c T_PARENT_RIGHT { + if ( ! check_in_range($3,0,255, &(@$)) ) { YYABORT; } + if ( ! check_in_range($5,0,255, &(@$)) ) { YYABORT; } + if ( ! check_in_range($7,0,255, &(@$)) ) { YYABORT; } + $$.alpha = $8; + $$.red = $3/255.0; + $$.green = $5/255.0; + $$.blue = $7/255.0; +} + /** rgba ( 0-255 0-255 0-255 / 0-1.0 ) */ +| T_COL_RGBA T_PARENT_LEFT T_INT T_INT T_INT t_property_color_opt_alpha_ws T_PARENT_RIGHT { + if ( ! check_in_range($3,0,255, &(@$)) ) { YYABORT; } + if ( ! check_in_range($4,0,255, &(@$)) ) { YYABORT; } + if ( ! check_in_range($5,0,255, &(@$)) ) { YYABORT; } + $$.alpha = $6; + $$.red = $3/255.0; + $$.green = $4/255.0; + $$.blue = $5/255.0; +} + /** rgba ( 0-100% , 0-100%, 0-100%, 0-1.0 ) */ +| T_COL_RGBA T_PARENT_LEFT t_property_color_value T_PERCENT T_COMMA t_property_color_value T_PERCENT T_COMMA t_property_color_value T_PERCENT t_property_color_opt_alpha_c T_PARENT_RIGHT { + if ( ! check_in_range($3,0,100, &(@$)) ) { YYABORT; } + if ( ! check_in_range($6,0,100, &(@$)) ) { YYABORT; } + if ( ! check_in_range($9,0,100, &(@$)) ) { YYABORT; } + $$.alpha = $11; $$.red = $3/100.0; $$.green = $6/100.0; $$.blue = $9/100.0; +} + /** rgba ( 0-100% 0-100% 0-100% / 0-1.0 ) */ +| T_COL_RGBA T_PARENT_LEFT t_property_color_value T_PERCENT t_property_color_value T_PERCENT t_property_color_value T_PERCENT t_property_color_opt_alpha_ws T_PARENT_RIGHT { + if ( ! check_in_range($3,0,100, &(@$)) ) { YYABORT; } + if ( ! check_in_range($5,0,100, &(@$)) ) { YYABORT; } + if ( ! check_in_range($7,0,100, &(@$)) ) { YYABORT; } + $$.alpha = $9; $$.red = $3/100.0; $$.green = $5/100.0; $$.blue = $7/100.0; +} + /** hwb with comma */ +| T_COL_HWB T_PARENT_LEFT t_property_color_value_angle T_COMMA t_property_color_value_unit T_COMMA t_property_color_value_unit t_property_color_opt_alpha_c T_PARENT_RIGHT { + double h = $3, w = $5, b = $7; + $$ = hwb_to_rgb ( h, w, b ); + $$.alpha = $8; +} + /** hwb whitespace */ +| T_COL_HWB T_PARENT_LEFT t_property_color_value_angle t_property_color_value_unit t_property_color_value_unit t_property_color_opt_alpha_ws T_PARENT_RIGHT { + double h = $3, w = $4, b = $5; + $$ = hwb_to_rgb ( h, w, b ); + $$.alpha = $6; +} + /** cmyk with comma */ +| T_COL_CMYK T_PARENT_LEFT t_property_color_value_unit T_COMMA t_property_color_value_unit T_COMMA t_property_color_value_unit T_COMMA t_property_color_value_unit t_property_color_opt_alpha_c T_PARENT_RIGHT { + $$.alpha = $10; + double c= $3, m= $5, y= $7, k= $9; + $$.red = (1.0-c)*(1.0-k); + $$.green = (1.0-m)*(1.0-k); + $$.blue = (1.0-y)*(1.0-k); +} + /** cmyk whitespace edition. */ +| T_COL_CMYK T_PARENT_LEFT t_property_color_value_unit t_property_color_value_unit t_property_color_value_unit t_property_color_value_unit t_property_color_opt_alpha_ws T_PARENT_RIGHT { + $$.alpha = $7; + double c= $3, m= $4, y= $5, k= $6; + $$.red = (1.0-c)*(1.0-k); + $$.green = (1.0-m)*(1.0-k); + $$.blue = (1.0-y)*(1.0-k); +} + /** hsl ( 0-360 0-100 % 0 - 100 % / alpha) */ +| T_COL_HSL T_PARENT_LEFT t_property_color_value_angle t_property_color_value_unit t_property_color_value_unit t_property_color_opt_alpha_ws T_PARENT_RIGHT { + double h = $3, s = $4, l = $5; + $$ = hsl_to_rgb ( h, s, l ); + $$.alpha = $6; +} + /** hsl ( 0-360 , 0-100 %, 0 - 100 %) */ +| T_COL_HSL T_PARENT_LEFT t_property_color_value_angle T_COMMA t_property_color_value_unit T_COMMA t_property_color_value_unit t_property_color_opt_alpha_c T_PARENT_RIGHT { + double h = $3, s = $5, l = $7; + $$ = hsl_to_rgb ( h, s, l ); + $$.alpha = $8; +} +/** Hex colors parsed by lexer. */ +| T_COLOR { + $$ = $1; +} +| T_COLOR_TRANSPARENT { + $$.alpha = 0.0; + $$.red = $$.green = $$.blue = 0.0; +} +| T_COLOR_NAME t_property_color_opt_alpha_ws { + $$ = $1; + $$.alpha = $2; +} +; +t_property_color_opt_alpha_c +: %empty { $$ = 1.0; } +| T_COMMA t_property_color_value_unit { $$ = $2;} +; +t_property_color_opt_alpha_ws +: %empty { $$ = 1.0; } +| T_FORWARD_SLASH t_property_color_value_unit { $$ = $2;} +; + t_property_color_value_angle +: t_property_color_value { $$ = $1/360.0; if ( ! check_in_range ( $1, 0, 360, &(@$))){YYABORT;}} +| t_property_color_value T_ANGLE_DEG { $$ = $1/360.0; if ( ! check_in_range ( $1, 0, 360, &(@$))){YYABORT;}} +| t_property_color_value T_ANGLE_RAD { $$ = $1/(2*G_PI); if ( ! check_in_range ( $1, 0.0, (2*G_PI), &(@$))){YYABORT;}} +| t_property_color_value T_ANGLE_GRAD { $$ = $1/400.0; if ( ! check_in_range ( $1, 0, 400, &(@$))){YYABORT;}} +| t_property_color_value T_ANGLE_TURN { $$ = $1; if ( ! check_in_range ( $1, 0.0, 1.0, &(@$))){YYABORT;}} +; + +t_property_color_value_unit +: t_property_color_value T_PERCENT { $$ = $1/100.0; if ( !check_in_range ( $1, 0, 100, &(@$))){YYABORT;}} +| t_property_color_value { $$ = $1; if ( !check_in_range ( $1, 0.0, 1.0, &(@$))){YYABORT;}} +; +/** Color value to be double or integer. */ +t_property_color_value +: T_DOUBLE { $$ = $1; } +| T_INT { $$ = $1; } +; + +/** Property name */ +t_property_name +: T_PROP_NAME { $$ = $1; } +; + +t_entry_name_path: +T_NAME_ELEMENT { $$ = g_list_append ( NULL, $1 );} +| t_entry_name_path T_NSEP T_NAME_ELEMENT { $$ = g_list_append ( $1, $3);} +| t_entry_name_path T_NSEP { $$ = $1; } ; %% diff --git a/meson.build b/meson.build index 5016c9db..2059d960 100644 --- a/meson.build +++ b/meson.build @@ -134,6 +134,7 @@ rofi_sources = files( 'source/timings.c', 'source/history.c', 'source/theme.c', + 'source/css-colors.c', 'source/widgets/box.c', 'source/widgets/container.c', 'source/widgets/widget.c', @@ -164,6 +165,7 @@ rofi_sources = files( 'include/timings.h', 'include/history.h', 'include/theme.h', + 'include/css-colors.h', 'include/default-theme.h', 'include/widgets/box.h', 'include/widgets/container.h', @@ -277,6 +279,7 @@ test('widget test', executable('widget.test', [ 'source/widgets/widget.c', 'source/widgets/textbox.c', 'source/theme.c', + 'source/css-colors.c', 'source/helper.c', 'source/x11-helper.c', 'config/config.c', @@ -293,6 +296,7 @@ test('box test', executable('box.test', [ 'source/widgets/widget.c', 'source/widgets/box.c', 'source/theme.c', + 'source/css-colors.c', 'config/config.c', ]), dependencies: deps, @@ -307,6 +311,7 @@ test('scrollbar test', executable('scrollbar.test', [ 'source/widgets/widget.c', 'source/widgets/scrollbar.c', 'source/theme.c', + 'source/css-colors.c', 'config/config.c', ]), dependencies: deps, @@ -321,6 +326,7 @@ test('textbox test', executable('textbox.test', [ 'source/widgets/widget.c', 'source/widgets/textbox.c', 'source/theme.c', + 'source/css-colors.c', 'source/helper.c', 'source/x11-helper.c', 'config/config.c', @@ -378,6 +384,7 @@ if check.found() 'source/xrmoptions.c', 'source/x11-helper.c', 'source/theme.c', + 'source/css-colors.c', ]), dependencies: deps, )) diff --git a/source/css-colors.c b/source/css-colors.c new file mode 100644 index 00000000..cc2a6b35 --- /dev/null +++ b/source/css-colors.c @@ -0,0 +1,154 @@ +#include +#include "css-colors.h" +const CSSColor CSSColors[] = { + { .name = "AliceBlue", .r = 0xF0, .g = 0xF8, .b = 0xFF }, + { .name = "AntiqueWhite", .r = 0xFA, .g = 0xEB, .b = 0xD7 }, + { .name = "Aqua", .r = 0x00, .g = 0xFF, .b = 0xFF }, + { .name = "Aquamarine", .r = 0x7F, .g = 0xFF, .b = 0xD4 }, + { .name = "Azure", .r = 0xF0, .g = 0xFF, .b = 0xFF }, + { .name = "Beige", .r = 0xF5, .g = 0xF5, .b = 0xDC }, + { .name = "Bisque", .r = 0xFF, .g = 0xE4, .b = 0xC4 }, + { .name = "Black", .r = 0x00, .g = 0x00, .b = 0x00 }, + { .name = "BlanchedAlmond", .r = 0xFF, .g = 0xEB, .b = 0xCD }, + { .name = "Blue", .r = 0x00, .g = 0x00, .b = 0xFF }, + { .name = "BlueViolet", .r = 0x8A, .g = 0x2B, .b = 0xE2 }, + { .name = "Brown", .r = 0xA5, .g = 0x2A, .b = 0x2A }, + { .name = "BurlyWood", .r = 0xDE, .g = 0xB8, .b = 0x87 }, + { .name = "CadetBlue", .r = 0x5F, .g = 0x9E, .b = 0xA0 }, + { .name = "Chartreuse", .r = 0x7F, .g = 0xFF, .b = 0x00 }, + { .name = "Chocolate", .r = 0xD2, .g = 0x69, .b = 0x1E }, + { .name = "Coral", .r = 0xFF, .g = 0x7F, .b = 0x50 }, + { .name = "CornflowerBlue", .r = 0x64, .g = 0x95, .b = 0xED }, + { .name = "Cornsilk", .r = 0xFF, .g = 0xF8, .b = 0xDC }, + { .name = "Crimson", .r = 0xDC, .g = 0x14, .b = 0x3C }, + { .name = "Cyan", .r = 0x00, .g = 0xFF, .b = 0xFF }, + { .name = "DarkBlue", .r = 0x00, .g = 0x00, .b = 0x8B }, + { .name = "DarkCyan", .r = 0x00, .g = 0x8B, .b = 0x8B }, + { .name = "DarkGoldenRod", .r = 0xB8, .g = 0x86, .b = 0x0B }, + { .name = "DarkGray", .r = 0xA9, .g = 0xA9, .b = 0xA9 }, + { .name = "DarkGrey", .r = 0xA9, .g = 0xA9, .b = 0xA9 }, + { .name = "DarkGreen", .r = 0x00, .g = 0x64, .b = 0x00 }, + { .name = "DarkKhaki", .r = 0xBD, .g = 0xB7, .b = 0x6B }, + { .name = "DarkMagenta", .r = 0x8B, .g = 0x00, .b = 0x8B }, + { .name = "DarkOliveGreen", .r = 0x55, .g = 0x6B, .b = 0x2F }, + { .name = "DarkOrange", .r = 0xFF, .g = 0x8C, .b = 0x00 }, + { .name = "DarkOrchid", .r = 0x99, .g = 0x32, .b = 0xCC }, + { .name = "DarkRed", .r = 0x8B, .g = 0x00, .b = 0x00 }, + { .name = "DarkSalmon", .r = 0xE9, .g = 0x96, .b = 0x7A }, + { .name = "DarkSeaGreen", .r = 0x8F, .g = 0xBC, .b = 0x8F }, + { .name = "DarkSlateBlue", .r = 0x48, .g = 0x3D, .b = 0x8B }, + { .name = "DarkSlateGray", .r = 0x2F, .g = 0x4F, .b = 0x4F }, + { .name = "DarkSlateGrey", .r = 0x2F, .g = 0x4F, .b = 0x4F }, + { .name = "DarkTurquoise", .r = 0x00, .g = 0xCE, .b = 0xD1 }, + { .name = "DarkViolet", .r = 0x94, .g = 0x00, .b = 0xD3 }, + { .name = "DeepPink", .r = 0xFF, .g = 0x14, .b = 0x93 }, + { .name = "DeepSkyBlue", .r = 0x00, .g = 0xBF, .b = 0xFF }, + { .name = "DimGray", .r = 0x69, .g = 0x69, .b = 0x69 }, + { .name = "DimGrey", .r = 0x69, .g = 0x69, .b = 0x69 }, + { .name = "DodgerBlue", .r = 0x1E, .g = 0x90, .b = 0xFF }, + { .name = "FireBrick", .r = 0xB2, .g = 0x22, .b = 0x22 }, + { .name = "FloralWhite", .r = 0xFF, .g = 0xFA, .b = 0xF0 }, + { .name = "ForestGreen", .r = 0x22, .g = 0x8B, .b = 0x22 }, + { .name = "Fuchsia", .r = 0xFF, .g = 0x00, .b = 0xFF }, + { .name = "Gainsboro", .r = 0xDC, .g = 0xDC, .b = 0xDC }, + { .name = "GhostWhite", .r = 0xF8, .g = 0xF8, .b = 0xFF }, + { .name = "Gold", .r = 0xFF, .g = 0xD7, .b = 0x00 }, + { .name = "GoldenRod", .r = 0xDA, .g = 0xA5, .b = 0x20 }, + { .name = "Gray", .r = 0x80, .g = 0x80, .b = 0x80 }, + { .name = "Grey", .r = 0x80, .g = 0x80, .b = 0x80 }, + { .name = "Green", .r = 0x00, .g = 0x80, .b = 0x00 }, + { .name = "GreenYellow", .r = 0xAD, .g = 0xFF, .b = 0x2F }, + { .name = "HoneyDew", .r = 0xF0, .g = 0xFF, .b = 0xF0 }, + { .name = "HotPink", .r = 0xFF, .g = 0x69, .b = 0xB4 }, + { .name = "IndianRed", .r = 0xCD, .g = 0x5C, .b = 0x5C }, + { .name = "Indigo", .r = 0x4B, .g = 0x00, .b = 0x82 }, + { .name = "Ivory", .r = 0xFF, .g = 0xFF, .b = 0xF0 }, + { .name = "Khaki", .r = 0xF0, .g = 0xE6, .b = 0x8C }, + { .name = "Lavender", .r = 0xE6, .g = 0xE6, .b = 0xFA }, + { .name = "LavenderBlush", .r = 0xFF, .g = 0xF0, .b = 0xF5 }, + { .name = "LawnGreen", .r = 0x7C, .g = 0xFC, .b = 0x00 }, + { .name = "LemonChiffon", .r = 0xFF, .g = 0xFA, .b = 0xCD }, + { .name = "LightBlue", .r = 0xAD, .g = 0xD8, .b = 0xE6 }, + { .name = "LightCoral", .r = 0xF0, .g = 0x80, .b = 0x80 }, + { .name = "LightCyan", .r = 0xE0, .g = 0xFF, .b = 0xFF }, + { .name = "LightGoldenRodYellow", .r = 0xFA, .g = 0xFA, .b = 0xD2 }, + { .name = "LightGray", .r = 0xD3, .g = 0xD3, .b = 0xD3 }, + { .name = "LightGrey", .r = 0xD3, .g = 0xD3, .b = 0xD3 }, + { .name = "LightGreen", .r = 0x90, .g = 0xEE, .b = 0x90 }, + { .name = "LightPink", .r = 0xFF, .g = 0xB6, .b = 0xC1 }, + { .name = "LightSalmon", .r = 0xFF, .g = 0xA0, .b = 0x7A }, + { .name = "LightSeaGreen", .r = 0x20, .g = 0xB2, .b = 0xAA }, + { .name = "LightSkyBlue", .r = 0x87, .g = 0xCE, .b = 0xFA }, + { .name = "LightSlateGray", .r = 0x77, .g = 0x88, .b = 0x99 }, + { .name = "LightSlateGrey", .r = 0x77, .g = 0x88, .b = 0x99 }, + { .name = "LightSteelBlue", .r = 0xB0, .g = 0xC4, .b = 0xDE }, + { .name = "LightYellow", .r = 0xFF, .g = 0xFF, .b = 0xE0 }, + { .name = "Lime", .r = 0x00, .g = 0xFF, .b = 0x00 }, + { .name = "LimeGreen", .r = 0x32, .g = 0xCD, .b = 0x32 }, + { .name = "Linen", .r = 0xFA, .g = 0xF0, .b = 0xE6 }, + { .name = "Magenta", .r = 0xFF, .g = 0x00, .b = 0xFF }, + { .name = "Maroon", .r = 0x80, .g = 0x00, .b = 0x00 }, + { .name = "MediumAquaMarine", .r = 0x66, .g = 0xCD, .b = 0xAA }, + { .name = "MediumBlue", .r = 0x00, .g = 0x00, .b = 0xCD }, + { .name = "MediumOrchid", .r = 0xBA, .g = 0x55, .b = 0xD3 }, + { .name = "MediumPurple", .r = 0x93, .g = 0x70, .b = 0xDB }, + { .name = "MediumSeaGreen", .r = 0x3C, .g = 0xB3, .b = 0x71 }, + { .name = "MediumSlateBlue", .r = 0x7B, .g = 0x68, .b = 0xEE }, + { .name = "MediumSpringGreen", .r = 0x00, .g = 0xFA, .b = 0x9A }, + { .name = "MediumTurquoise", .r = 0x48, .g = 0xD1, .b = 0xCC }, + { .name = "MediumVioletRed", .r = 0xC7, .g = 0x15, .b = 0x85 }, + { .name = "MidnightBlue", .r = 0x19, .g = 0x19, .b = 0x70 }, + { .name = "MintCream", .r = 0xF5, .g = 0xFF, .b = 0xFA }, + { .name = "MistyRose", .r = 0xFF, .g = 0xE4, .b = 0xE1 }, + { .name = "Moccasin", .r = 0xFF, .g = 0xE4, .b = 0xB5 }, + { .name = "NavajoWhite", .r = 0xFF, .g = 0xDE, .b = 0xAD }, + { .name = "Navy", .r = 0x00, .g = 0x00, .b = 0x80 }, + { .name = "OldLace", .r = 0xFD, .g = 0xF5, .b = 0xE6 }, + { .name = "Olive", .r = 0x80, .g = 0x80, .b = 0x00 }, + { .name = "OliveDrab", .r = 0x6B, .g = 0x8E, .b = 0x23 }, + { .name = "Orange", .r = 0xFF, .g = 0xA5, .b = 0x00 }, + { .name = "OrangeRed", .r = 0xFF, .g = 0x45, .b = 0x00 }, + { .name = "Orchid", .r = 0xDA, .g = 0x70, .b = 0xD6 }, + { .name = "PaleGoldenRod", .r = 0xEE, .g = 0xE8, .b = 0xAA }, + { .name = "PaleGreen", .r = 0x98, .g = 0xFB, .b = 0x98 }, + { .name = "PaleTurquoise", .r = 0xAF, .g = 0xEE, .b = 0xEE }, + { .name = "PaleVioletRed", .r = 0xDB, .g = 0x70, .b = 0x93 }, + { .name = "PapayaWhip", .r = 0xFF, .g = 0xEF, .b = 0xD5 }, + { .name = "PeachPuff", .r = 0xFF, .g = 0xDA, .b = 0xB9 }, + { .name = "Peru", .r = 0xCD, .g = 0x85, .b = 0x3F }, + { .name = "Pink", .r = 0xFF, .g = 0xC0, .b = 0xCB }, + { .name = "Plum", .r = 0xDD, .g = 0xA0, .b = 0xDD }, + { .name = "PowderBlue", .r = 0xB0, .g = 0xE0, .b = 0xE6 }, + { .name = "Purple", .r = 0x80, .g = 0x00, .b = 0x80 }, + { .name = "RebeccaPurple", .r = 0x66, .g = 0x33, .b = 0x99 }, + { .name = "Red", .r = 0xFF, .g = 0x00, .b = 0x00 }, + { .name = "RosyBrown", .r = 0xBC, .g = 0x8F, .b = 0x8F }, + { .name = "RoyalBlue", .r = 0x41, .g = 0x69, .b = 0xE1 }, + { .name = "SaddleBrown", .r = 0x8B, .g = 0x45, .b = 0x13 }, + { .name = "Salmon", .r = 0xFA, .g = 0x80, .b = 0x72 }, + { .name = "SandyBrown", .r = 0xF4, .g = 0xA4, .b = 0x60 }, + { .name = "SeaGreen", .r = 0x2E, .g = 0x8B, .b = 0x57 }, + { .name = "SeaShell", .r = 0xFF, .g = 0xF5, .b = 0xEE }, + { .name = "Sienna", .r = 0xA0, .g = 0x52, .b = 0x2D }, + { .name = "Silver", .r = 0xC0, .g = 0xC0, .b = 0xC0 }, + { .name = "SkyBlue", .r = 0x87, .g = 0xCE, .b = 0xEB }, + { .name = "SlateBlue", .r = 0x6A, .g = 0x5A, .b = 0xCD }, + { .name = "SlateGray", .r = 0x70, .g = 0x80, .b = 0x90 }, + { .name = "SlateGrey", .r = 0x70, .g = 0x80, .b = 0x90 }, + { .name = "Snow", .r = 0xFF, .g = 0xFA, .b = 0xFA }, + { .name = "SpringGreen", .r = 0x00, .g = 0xFF, .b = 0x7F }, + { .name = "SteelBlue", .r = 0x46, .g = 0x82, .b = 0xB4 }, + { .name = "Tan", .r = 0xD2, .g = 0xB4, .b = 0x8C }, + { .name = "Teal", .r = 0x00, .g = 0x80, .b = 0x80 }, + { .name = "Thistle", .r = 0xD8, .g = 0xBF, .b = 0xD8 }, + { .name = "Tomato", .r = 0xFF, .g = 0x63, .b = 0x47 }, + { .name = "Turquoise", .r = 0x40, .g = 0xE0, .b = 0xD0 }, + { .name = "Violet", .r = 0xEE, .g = 0x82, .b = 0xEE }, + { .name = "Wheat", .r = 0xF5, .g = 0xDE, .b = 0xB3 }, + { .name = "White", .r = 0xFF, .g = 0xFF, .b = 0xFF }, + { .name = "WhiteSmoke", .r = 0xF5, .g = 0xF5, .b = 0xF5 }, + { .name = "Yellow", .r = 0xFF, .g = 0xFF, .b = 0x00 }, + { .name = "YellowGreen", .r = 0x9A, .g = 0xCD, .b = 0x32 } +}; + +const unsigned int num_CSSColors = sizeof ( CSSColors ) / sizeof ( *CSSColors ); diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c index a639646c..36392da4 100644 --- a/source/dialogs/ssh.c +++ b/source/dialogs/ssh.c @@ -298,7 +298,7 @@ static void parse_ssh_config_file ( const char *filename, char ***retv, unsigned else { full_path = g_strdup ( path ); } - glob_t globbuf = { 0, }; + glob_t globbuf = { .gl_pathc = 0, .gl_pathv = NULL, .gl_offs = 0 }; if ( glob ( full_path, 0, NULL, &globbuf ) == 0 ) { for ( size_t iter = 0; iter < globbuf.gl_pathc; iter++ ) { diff --git a/source/helper.c b/source/helper.c index d31a4e20..7fa07478 100644 --- a/source/helper.c +++ b/source/helper.c @@ -423,6 +423,18 @@ PangoAttrList *helper_token_match_get_pango_attr ( ThemeHighlight th, GRegex **t pa->end_index = end; pango_attr_list_insert ( retv, pa ); } + if ( th.style & HL_STRIKETHROUGH ) { + PangoAttribute *pa = pango_attr_strikethrough_new ( TRUE ); + pa->start_index = start; + pa->end_index = end; + pango_attr_list_insert ( retv, pa ); + } + if ( th.style & HL_SMALL_CAPS ) { + PangoAttribute *pa = pango_attr_variant_new ( PANGO_VARIANT_SMALL_CAPS ); + pa->start_index = start; + pa->end_index = end; + pango_attr_list_insert ( retv, pa ); + } if ( th.style & HL_ITALIC ) { PangoAttribute *pa = pango_attr_style_new ( PANGO_STYLE_ITALIC ); pa->start_index = start; diff --git a/source/rofi.c b/source/rofi.c index 4ca2460e..e802f0ed 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1148,17 +1148,16 @@ int main ( int argc, char *argv[] ) // Load in config from X resources. config_parse_xresource_options ( xcb ); config_parse_xresource_options_file ( config_path ); - - find_arg_str ( "-theme", &( config.theme ) ); - if ( config.theme ) { - TICK_N ( "Parse theme" ); - if ( rofi_theme_parse_file ( config.theme ) ) { - // TODO: instantiate fallback theme.? - rofi_theme_free ( rofi_theme ); - rofi_theme = NULL; - } - TICK_N ( "Parsed theme" ); + } + find_arg_str ( "-theme", &( config.theme ) ); + if ( config.theme ) { + TICK_N ( "Parse theme" ); + if ( rofi_theme_parse_file ( config.theme ) ) { + // TODO: instantiate fallback theme.? + rofi_theme_free ( rofi_theme ); + rofi_theme = NULL; } + TICK_N ( "Parsed theme" ); } // Parse command line for settings, independent of other -no-config. config_parse_cmd_options ( ); diff --git a/source/theme.c b/source/theme.c index 274a866a..1c4711c6 100644 --- a/source/theme.c +++ b/source/theme.c @@ -170,15 +170,18 @@ static void rofi_theme_print_property_index ( size_t pnl, int depth, Property *p if ( p->value.highlight.style & HL_UNDERLINE ) { printf ( "underline " ); } + if ( p->value.highlight.style & HL_STRIKETHROUGH ) { + printf ( "strikethrough " ); + } if ( p->value.highlight.style & HL_ITALIC ) { printf ( "italic " ); } if ( p->value.highlight.style & HL_COLOR ) { - printf ( "#%02X%02X%02X%02X", - (unsigned char) ( p->value.highlight.color.alpha * 255.0 ), - (unsigned char) ( p->value.highlight.color.red * 255.0 ), - (unsigned char) ( p->value.highlight.color.green * 255.0 ), - (unsigned char) ( p->value.highlight.color.blue * 255.0 ) ); + printf ( "rgba ( %.0f, %.0f, %.0f, %.0f %% )", + ( p->value.highlight.color.red * 255.0 ), + ( p->value.highlight.color.green * 255.0 ), + ( p->value.highlight.color.blue * 255.0 ), + ( p->value.highlight.color.alpha * 100.0 ) ); } printf ( ";" ); break; @@ -198,11 +201,11 @@ static void rofi_theme_print_property_index ( size_t pnl, int depth, Property *p printf ( "%s;", p->value.b ? "true" : "false" ); break; case P_COLOR: - printf ( "#%02X%02X%02X%02X;", - (unsigned char) ( p->value.color.alpha * 255.0 ), - (unsigned char) ( p->value.color.red * 255.0 ), - (unsigned char) ( p->value.color.green * 255.0 ), - (unsigned char) ( p->value.color.blue * 255.0 ) ); + printf ( "rgba ( %.0f, %.0f, %.0f, %.0f %% );", + ( p->value.color.red * 255.0 ), + ( p->value.color.green * 255.0 ), + ( p->value.color.blue * 255.0 ), + ( p->value.color.alpha * 100.0 ) ); break; case P_PADDING: if ( distance_compare ( p->value.padding.top, p->value.padding.bottom ) && @@ -318,7 +321,7 @@ extern FILE* yyin; */ void yyerror ( YYLTYPE *yylloc, const char *what, const char* s ) { - char *what_esc = g_markup_escape_text ( what, -1 ); + char *what_esc = what ? g_markup_escape_text ( what, -1 ) : g_strdup ( "" ); GString *str = g_string_new ( "" ); g_string_printf ( str, "Error while parsing theme: %s\n", what_esc ); g_free ( what_esc ); @@ -636,25 +639,39 @@ gboolean rofi_theme_is_empty ( void ) #ifdef THEME_CONVERTER +static char * rofi_theme_convert_color ( char *col ) +{ + char *r = g_strstrip ( col ); + if ( *r == '#' && strlen ( r ) == 9 ) { + char t1 = r[7]; + char t2 = r[8]; + r[7] = r[1]; + r[8] = r[2]; + r[1] = t1; + r[2] = t2; + } + + return r; +} void rofi_theme_convert_old ( void ) { if ( config.color_window ) { - char **retv = g_strsplit ( config.color_window, ",", -1 ); - const char const *conf[] = { + char **retv = g_strsplit ( config.color_window, ",", -1 ); + const char * const conf[] = { "* { background: %s; }", "* { bordercolor: %s; }", "* { separatorcolor: %s; }" }; for ( int i = 0; retv && retv[i] && i < 3; i++ ) { - char *str = g_strdup_printf ( conf[i], retv[i] ); + char *str = g_strdup_printf ( conf[i], rofi_theme_convert_color ( retv[i] ) ); rofi_theme_parse_string ( str ); g_free ( str ); } g_strfreev ( retv ); } if ( config.color_normal ) { - char **retv = g_strsplit ( config.color_normal, ",", -1 ); - const char const *conf[] = { + char **retv = g_strsplit ( config.color_normal, ",", -1 ); + const char * const conf[] = { "* { normal-background: %s; }", "* { foreground: %s; normal-foreground: @foreground; alternate-normal-foreground: @foreground; }", "* { alternate-normal-background: %s; }", @@ -662,15 +679,15 @@ void rofi_theme_convert_old ( void ) "* { selected-normal-foreground: %s; }" }; for ( int i = 0; retv && retv[i]; i++ ) { - char *str = g_strdup_printf ( conf[i], retv[i] ); + char *str = g_strdup_printf ( conf[i], rofi_theme_convert_color ( retv[i] ) ); rofi_theme_parse_string ( str ); g_free ( str ); } g_strfreev ( retv ); } if ( config.color_urgent ) { - char **retv = g_strsplit ( config.color_urgent, ",", -1 ); - const char const *conf[] = { + char **retv = g_strsplit ( config.color_urgent, ",", -1 ); + const char * const conf[] = { "* { urgent-background: %s; }", "* { urgent-foreground: %s; alternate-urgent-foreground: @urgent-foreground;}", "* { alternate-urgent-background: %s; }", @@ -678,15 +695,15 @@ void rofi_theme_convert_old ( void ) "* { selected-urgent-foreground: %s; }" }; for ( int i = 0; retv && retv[i]; i++ ) { - char *str = g_strdup_printf ( conf[i], retv[i] ); + char *str = g_strdup_printf ( conf[i], rofi_theme_convert_color ( retv[i] ) ); rofi_theme_parse_string ( str ); g_free ( str ); } g_strfreev ( retv ); } if ( config.color_active ) { - char **retv = g_strsplit ( config.color_active, ",", -1 ); - const char const *conf[] = { + char **retv = g_strsplit ( config.color_active, ",", -1 ); + const char * const conf[] = { "* { active-background: %s; }", "* { active-foreground: %s; alternate-active-foreground: @active-foreground;}", "* { alternate-active-background: %s; }", @@ -694,7 +711,7 @@ void rofi_theme_convert_old ( void ) "* { selected-active-foreground: %s; }" }; for ( int i = 0; retv && retv[i]; i++ ) { - char *str = g_strdup_printf ( conf[i], retv[i] ); + char *str = g_strdup_printf ( conf[i], rofi_theme_convert_color ( retv[i] ) ); rofi_theme_parse_string ( str ); g_free ( str ); } diff --git a/source/view.c b/source/view.c index 3186c873..416bad7d 100644 --- a/source/view.c +++ b/source/view.c @@ -68,6 +68,11 @@ #include "theme.h" #include "xcb.h" + +#ifdef XkBCOMMON_HAS_CONSUMED2 +#define xkb_state_key_get_consumed_mods( s, k ) xkb_state_key_get_consumed_mods2 ( s, k, XKB_CONSUMED_MODE_GTK ) +#endif + /** * @param state The handle to the view * @param qr Indicate if queue_redraw should be called on changes. @@ -709,8 +714,8 @@ void __create_window ( MenuFlags menu_flags ) } // Setup font. // Dummy widget. - container *win = container_create ( "window.box" ); - const char *font = rofi_theme_get_string ( WIDGET ( win ), "font", config.menu_font ); + container *win = container_create ( "window.box" ); + const char *font = rofi_theme_get_string ( WIDGET ( win ), "font", config.menu_font ); if ( font ) { PangoFontDescription *pfd = pango_font_description_from_string ( font ); if ( helper_validate_font ( pfd, font ) ) { @@ -1292,7 +1297,19 @@ gboolean rofi_view_trigger_action ( RofiViewState *state, KeyBindingAction actio break; // If you add a binding here, make sure to add it to textbox_keybinding too case MOVE_CHAR_BACK: + { + if ( textbox_keybinding ( state->text, action ) == 0 ) { + listview_nav_left ( state->list_view ); + } + break; + } case MOVE_CHAR_FORWARD: + { + if ( textbox_keybinding ( state->text, action ) == 0 ) { + listview_nav_right ( state->list_view ); + } + break; + } case CLEAR_LINE: case MOVE_FRONT: case MOVE_END: diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index 16e1ed69..c0761f11 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -135,7 +135,7 @@ textbox* textbox_create ( const char *name, TextboxFlags flags, TextBoxFontType if ( helper_validate_font ( tbfc->pfd, font ) ) { tbfc->metrics = pango_context_get_metrics ( p_context, tbfc->pfd, NULL ); // Cast away consts. (*yuck*) because table_insert does not know it is const. - g_hash_table_insert ( tbfc_cache, (char *)font, tbfc ); + g_hash_table_insert ( tbfc_cache, (char *) font, tbfc ); } else { pango_font_description_free ( tbfc->pfd ); @@ -173,7 +173,7 @@ textbox* textbox_create ( const char *name, TextboxFlags flags, TextBoxFontType /** * State names used for theming. */ -const char const *const theme_prop_names[][3] = { +const char *const theme_prop_names[][3] = { /** Normal row */ { "normal.normal", "selected.normal", "alternate.normal" }, /** Urgent row */ @@ -405,20 +405,28 @@ void textbox_cursor ( textbox *tb, int pos ) * @param tb Handle to the textbox * * Move cursor one position forward. + * + * @returns if cursor was moved. */ -static void textbox_cursor_inc ( textbox *tb ) +static int textbox_cursor_inc ( textbox *tb ) { + int old = tb->cursor; textbox_cursor ( tb, tb->cursor + 1 ); + return old != tb->cursor; } /** * @param tb Handle to the textbox * * Move cursor one position backward. + * + * @returns if cursor was moved. */ -static void textbox_cursor_dec ( textbox *tb ) +static int textbox_cursor_dec ( textbox *tb ) { + int old = tb->cursor; textbox_cursor ( tb, tb->cursor - 1 ); + return old != tb->cursor; } // Move word right @@ -625,12 +633,10 @@ int textbox_keybinding ( textbox *tb, KeyBindingAction action ) { // Left or Ctrl-b case MOVE_CHAR_BACK: - textbox_cursor_dec ( tb ); - return 2; + return ( textbox_cursor_dec ( tb ) == TRUE ) ? 2 : 0; // Right or Ctrl-F case MOVE_CHAR_FORWARD: - textbox_cursor_inc ( tb ); - return 2; + return ( textbox_cursor_inc ( tb ) == TRUE ) ? 2 : 0; // Ctrl-U: Kill from the beginning to the end of the line. case CLEAR_LINE: textbox_text ( tb, "" ); @@ -791,3 +797,17 @@ int textbox_get_estimated_height ( const textbox *tb, int eh ) int height = pango_font_metrics_get_ascent ( tb->metrics ) + pango_font_metrics_get_descent ( tb->metrics ); return ( eh * height ) / PANGO_SCALE + widget_padding_get_padding_height ( WIDGET ( tb ) ); } +int textbox_get_desired_width ( widget *wid ) +{ + textbox *tb = (textbox *) wid; + unsigned int offset = ( tb->flags & TB_INDICATOR ) ? DOT_OFFSET : 0; + if ( tb->flags & TB_AUTOWIDTH ) { + return textbox_get_font_width ( tb ) + widget_padding_get_padding_width ( wid ) + offset; + } + int width = 0; + pango_layout_set_width ( tb->layout, -1); + width = textbox_get_font_width ( tb ); + // Restore. + pango_layout_set_width ( tb->layout, PANGO_SCALE * ( tb->widget.w - widget_padding_get_padding_width ( WIDGET ( tb ) ) - offset ) ); + return width + widget_padding_get_padding_width ( wid ) + offset; +} diff --git a/source/x11-helper.c b/source/x11-helper.c index 0e58d829..5e1dce04 100644 --- a/source/x11-helper.c +++ b/source/x11-helper.c @@ -659,11 +659,13 @@ unsigned int x11_get_current_mask ( xkb_stuff *xkb ) // convert a Mod+key arg to mod mask and keysym gboolean x11_parse_key ( const char *combo, unsigned int *mod, xkb_keysym_t *key, gboolean *release, GString *str ) { - char *input_key = g_strdup ( combo ); - char *mod_key = input_key; - char *error_msg = NULL; - unsigned int modmask = 0; - xkb_keysym_t sym = XKB_KEY_NoSymbol; + char *input_key = g_strdup ( combo ); + char *mod_key = input_key; + char *error_msg = NULL; + unsigned int last_modmask = 0; + unsigned int modmask = 0; + xkb_keysym_t last_sym = XKB_KEY_NoSymbol; + xkb_keysym_t sym = XKB_KEY_NoSymbol; // Test if this works on release. if ( g_str_has_prefix ( mod_key, "!" ) ) { ++mod_key; @@ -676,6 +678,8 @@ gboolean x11_parse_key ( const char *combo, unsigned int *mod, xkb_keysym_t *key // Remove trailing and leading spaces. entry = g_strstrip ( entry ); // Compare against lowered version. + last_modmask = modmask; + last_sym = xkb_keysym_from_name ( entry, XKB_KEYSYM_NO_FLAGS ); char *entry_lowered = g_utf8_strdown ( entry, -1 ); if ( g_utf8_collate ( entry_lowered, "shift" ) == 0 ) { modmask |= x11_mod_masks[X11MOD_SHIFT]; @@ -720,7 +724,7 @@ gboolean x11_parse_key ( const char *combo, unsigned int *mod, xkb_keysym_t *key if ( sym != XKB_KEY_NoSymbol ) { error_msg = g_markup_printf_escaped ( "Only one (non modifier) key can be bound per binding: %s is invalid.\n", entry ); } - sym = xkb_keysym_from_name ( entry, XKB_KEYSYM_NO_FLAGS ); + sym = last_sym; if ( sym == XKB_KEY_NoSymbol ) { error_msg = g_markup_printf_escaped ( "∙ Key %s is not understood\n", entry ); } @@ -730,6 +734,10 @@ gboolean x11_parse_key ( const char *combo, unsigned int *mod, xkb_keysym_t *key g_strfreev ( entries ); g_free ( input_key ); + if ( ( sym == XKB_KEY_NoSymbol ) && ( last_sym != XKB_KEY_NoSymbol ) ) { + sym = last_sym; + modmask = last_modmask; + } if ( error_msg ) { char *name = g_markup_escape_text ( combo, -1 ); diff --git a/subprojects/libgwater b/subprojects/libgwater index 60e5e71e..e1f98d37 160000 --- a/subprojects/libgwater +++ b/subprojects/libgwater @@ -1 +1 @@ -Subproject commit 60e5e71e09e573bd5c7839ce4a892747ea232526 +Subproject commit e1f98d377f2b1dbeab224e48e9c55b7be99a9e14 diff --git a/test/convert_old_theme_test.sh b/test/convert_old_theme_test.sh new file mode 100755 index 00000000..75fc392b --- /dev/null +++ b/test/convert_old_theme_test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +TOP_DIR=$1 + +xrdb -retain -load ${TOP_DIR}/doc/old-theme-convert-input.theme +rofi -config ${TOP_DIR}/doc/old-theme-convert-input.theme -dump-theme > temp.txt + +if ! diff temp.txt ${TOP_DIR}/doc/old-theme-convert-output.rasi > /dev/null +then + echo "Convert default theme failed" + diff temp.txt ${TOP_DIR}/doc/old-theme-convert-output.rasi + exit 1; +fi + +exit ${RETV} diff --git a/test/default_theme_test.sh b/test/default_theme_test.sh new file mode 100755 index 00000000..8baa66c9 --- /dev/null +++ b/test/default_theme_test.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +TOP_DIR=$1 + +rofi -no-config -dump-theme > temp.txt + +if ! diff temp.txt ${TOP_DIR}/doc/default_theme.rasi > /dev/null +then + echo "Dump default theme does not match." + diff temp.txt ${TOP_DIR}/doc/default_theme.rasi + exit 1; +fi + +exit ${RETV} diff --git a/test/run_all_tests.sh b/test/run_all_tests.sh index 4d830169..6625c6da 100755 --- a/test/run_all_tests.sh +++ b/test/run_all_tests.sh @@ -19,6 +19,8 @@ tests=( run_glob_test run_issue333_test help_output_test + default_theme_test + convert_old_theme_test run_dmenu_normal_window_test run_window_test ) diff --git a/test/theme-parser-test.c b/test/theme-parser-test.c index 19f1744b..1b6d7f06 100644 --- a/test/theme-parser-test.c +++ b/test/theme-parser-test.c @@ -36,6 +36,7 @@ #include "rofi.h" #include "settings.h" #include "theme.h" +#include "css-colors.h" #include "widgets/widget-internal.h" #include "widgets/textbox.h" @@ -86,7 +87,7 @@ gboolean error = FALSE; GString *error_msg = NULL; void rofi_add_error_message ( GString *msg ) { - ck_assert_ptr_null ( error_msg ); + ck_assert_ptr_null ( error_msg ); error_msg = msg; error = TRUE; } @@ -332,6 +333,27 @@ START_TEST ( test_properties_position) ck_assert_int_eq ( rofi_theme_get_position ( &wid, "southeast", WL_WEST) , WL_SOUTH_EAST); ck_assert_int_eq ( rofi_theme_get_position ( &wid, "northwest", WL_NORTH) , WL_NORTH_WEST); ck_assert_int_eq ( rofi_theme_get_position ( &wid, "northeast", WL_CENTER) , WL_NORTH_EAST); + rofi_theme_parse_string ( "* { southwest: south west; southeast: south east; northwest: north west; northeast:north east;}" ); + ck_assert_int_eq ( rofi_theme_get_position ( &wid, "southwest", WL_EAST) , WL_SOUTH_WEST); + ck_assert_int_eq ( rofi_theme_get_position ( &wid, "southeast", WL_WEST) , WL_SOUTH_EAST); + ck_assert_int_eq ( rofi_theme_get_position ( &wid, "northwest", WL_NORTH) , WL_NORTH_WEST); + ck_assert_int_eq ( rofi_theme_get_position ( &wid, "northeast", WL_CENTER) , WL_NORTH_EAST); + rofi_theme_parse_string ( "* { westsouth: westsouth; eastsouth: eastsouth; westnorth: westnorth; eastnorth:eastnorth;}" ); + ck_assert_int_eq ( rofi_theme_get_position ( &wid, "westsouth", WL_EAST) , WL_SOUTH_WEST); + ck_assert_int_eq ( rofi_theme_get_position ( &wid, "eastsouth", WL_WEST) , WL_SOUTH_EAST); + ck_assert_int_eq ( rofi_theme_get_position ( &wid, "westnorth", WL_NORTH) , WL_NORTH_WEST); + ck_assert_int_eq ( rofi_theme_get_position ( &wid, "eastnorth", WL_CENTER) , WL_NORTH_EAST); + rofi_theme_parse_string ( "* { westsouth: west south; eastsouth: east south; westnorth: west north; eastnorth:east north;}" ); + ck_assert_int_eq ( rofi_theme_get_position ( &wid, "westsouth", WL_EAST) , WL_SOUTH_WEST); + ck_assert_int_eq ( rofi_theme_get_position ( &wid, "eastsouth", WL_WEST) , WL_SOUTH_EAST); + ck_assert_int_eq ( rofi_theme_get_position ( &wid, "westnorth", WL_NORTH) , WL_NORTH_WEST); + ck_assert_int_eq ( rofi_theme_get_position ( &wid, "eastnorth", WL_CENTER) , WL_NORTH_EAST); + rofi_theme_parse_string ( "* { westeast: west east;}" ); + // Should return error. + // TODO: check error message. + g_string_free ( error_msg, TRUE); + error_msg = NULL; + error = 0; } END_TEST @@ -340,7 +362,7 @@ START_TEST ( test_properties_style) widget wid; wid.name = "blaat"; wid.state = NULL; - rofi_theme_parse_string ( "* { none: none; bold: bold; underline: underline; italic: italic;}"); + rofi_theme_parse_string ( "* { none: none; bold: bold; underline: underline; italic: italic; st: italic strikethrough;}"); ThemeHighlight th = { HL_BOLD, {0.0,0.0,0.0,0.0}}; th = rofi_theme_get_highlight ( &wid, "none", th); ck_assert_int_eq ( th.style , HL_NONE ); @@ -350,6 +372,8 @@ START_TEST ( test_properties_style) ck_assert_int_eq ( th.style , HL_ITALIC); th = rofi_theme_get_highlight ( &wid, "bold", th); ck_assert_int_eq ( th.style , HL_BOLD); + th = rofi_theme_get_highlight ( &wid, "st", th); + ck_assert_int_eq ( th.style , HL_ITALIC|HL_STRIKETHROUGH); } END_TEST START_TEST ( test_properties_style2 ) @@ -435,12 +459,39 @@ START_TEST ( test_properties_color_h6 ) } END_TEST +START_TEST ( test_properties_color_h4 ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + rofi_theme_parse_string ( "* { red: #F003; green: #0F02; blue: #00F1; }"); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + Property *p = rofi_theme_find_property ( twid, P_COLOR, "red", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.2 ); + ck_assert_double_eq ( p->value.color.red , 1 ); + ck_assert_double_eq ( p->value.color.green , 0 ); + ck_assert_double_eq ( p->value.color.blue , 0 ); + p = rofi_theme_find_property ( twid, P_COLOR, "green", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 1/7.5 ); + ck_assert_double_eq ( p->value.color.red , 0 ); + ck_assert_double_eq ( p->value.color.green , 1 ); + ck_assert_double_eq ( p->value.color.blue , 0 ); + p = rofi_theme_find_property ( twid, P_COLOR, "blue", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 1/15.0 ); + ck_assert_double_eq ( p->value.color.red , 0 ); + ck_assert_double_eq ( p->value.color.green , 0 ); + ck_assert_double_eq ( p->value.color.blue , 1 ); +} +END_TEST START_TEST ( test_properties_color_h8 ) { widget wid; wid.name = "blaat"; wid.state = NULL; - rofi_theme_parse_string ( "* { red: #33FF0000; green: #2200FF00; blue: #110000FF; }"); + rofi_theme_parse_string ( "* { red: #FF000033; green: #00FF0022; blue: #0000FF11; }"); ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); Property *p = rofi_theme_find_property ( twid, P_COLOR, "red", FALSE ); ck_assert_ptr_nonnull ( p ); @@ -463,6 +514,84 @@ START_TEST ( test_properties_color_h8 ) } END_TEST START_TEST ( test_properties_color_rgb ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + rofi_theme_parse_string ( "* { red: rgb(100%,0%,0%); green: rgb(0%,100%,0%); blue: rgb(0%,0%,100%); }"); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + Property *p = rofi_theme_find_property ( twid, P_COLOR, "red", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.red , 1 ); + ck_assert_double_eq ( p->value.color.green , 0 ); + ck_assert_double_eq ( p->value.color.blue , 0 ); + p = rofi_theme_find_property ( twid, P_COLOR, "green", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.red , 0 ); + ck_assert_double_eq ( p->value.color.green , 1 ); + ck_assert_double_eq ( p->value.color.blue , 0 ); + p = rofi_theme_find_property ( twid, P_COLOR, "blue", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.red , 0 ); + ck_assert_double_eq ( p->value.color.green , 0 ); + ck_assert_double_eq ( p->value.color.blue , 1 ); +} +END_TEST +START_TEST ( test_properties_color_rgba_p ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + rofi_theme_parse_string ( "* { red: rgba(100%,0%,0%,0.3); green: rgba(0%,100%,0%,0.2); blue: rgba(0%,0%,100%,0.7); }"); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + Property *p = rofi_theme_find_property ( twid, P_COLOR, "red", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.3 ); + ck_assert_double_eq ( p->value.color.red , 1 ); + ck_assert_double_eq ( p->value.color.green , 0 ); + ck_assert_double_eq ( p->value.color.blue , 0 ); + p = rofi_theme_find_property ( twid, P_COLOR, "green", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.2 ); + ck_assert_double_eq ( p->value.color.red , 0 ); + ck_assert_double_eq ( p->value.color.green , 1 ); + ck_assert_double_eq ( p->value.color.blue , 0 ); + p = rofi_theme_find_property ( twid, P_COLOR, "blue", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.7 ); + ck_assert_double_eq ( p->value.color.red , 0 ); + ck_assert_double_eq ( p->value.color.green , 0 ); + ck_assert_double_eq ( p->value.color.blue , 1 ); +} +END_TEST +START_TEST ( test_properties_color_rgba_percent_p ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + rofi_theme_parse_string ( "* { red: rgba(100%,0%,0%,30%); green: rgba(0%,100%,0%,20%); blue: rgba(0% 0% 100%/70.0%); }"); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + Property *p = rofi_theme_find_property ( twid, P_COLOR, "red", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.3 ); + ck_assert_double_eq ( p->value.color.red , 1 ); + ck_assert_double_eq ( p->value.color.green , 0 ); + ck_assert_double_eq ( p->value.color.blue , 0 ); + p = rofi_theme_find_property ( twid, P_COLOR, "green", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.2 ); + ck_assert_double_eq ( p->value.color.red , 0 ); + ck_assert_double_eq ( p->value.color.green , 1 ); + ck_assert_double_eq ( p->value.color.blue , 0 ); + p = rofi_theme_find_property ( twid, P_COLOR, "blue", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.7 ); + ck_assert_double_eq ( p->value.color.red , 0 ); + ck_assert_double_eq ( p->value.color.green , 0 ); + ck_assert_double_eq ( p->value.color.blue , 1 ); +} +END_TEST +START_TEST ( test_properties_color_rgb_p ) { widget wid; wid.name = "blaat"; @@ -491,7 +620,7 @@ START_TEST ( test_properties_color_rgba ) widget wid; wid.name = "blaat"; wid.state = NULL; - rofi_theme_parse_string ( "* { red: rgba(255,0,0,0.3); green: rgba(0,255,0,0.2); blue: rgba(0,0,255,0.7); }"); + rofi_theme_parse_string ( "* { red: rgba(255,0,0,0.3); green: rgba(0,255,0,0.2); blue: rgba(0 0 255 /0.7); }"); ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); Property *p = rofi_theme_find_property ( twid, P_COLOR, "red", FALSE ); ck_assert_ptr_nonnull ( p ); @@ -513,6 +642,33 @@ START_TEST ( test_properties_color_rgba ) ck_assert_double_eq ( p->value.color.blue , 1 ); } END_TEST +START_TEST ( test_properties_color_rgba_percent ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + rofi_theme_parse_string ( "* { red: rgba(255,0,0,30%); green: rgba(0,255,0,20%); blue: rgba(0,0,255,70.0%); }"); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + Property *p = rofi_theme_find_property ( twid, P_COLOR, "red", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.3 ); + ck_assert_double_eq ( p->value.color.red , 1 ); + ck_assert_double_eq ( p->value.color.green , 0 ); + ck_assert_double_eq ( p->value.color.blue , 0 ); + p = rofi_theme_find_property ( twid, P_COLOR, "green", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.2 ); + ck_assert_double_eq ( p->value.color.red , 0 ); + ck_assert_double_eq ( p->value.color.green , 1 ); + ck_assert_double_eq ( p->value.color.blue , 0 ); + p = rofi_theme_find_property ( twid, P_COLOR, "blue", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.7 ); + ck_assert_double_eq ( p->value.color.red , 0 ); + ck_assert_double_eq ( p->value.color.green , 0 ); + ck_assert_double_eq ( p->value.color.blue , 1 ); +} +END_TEST START_TEST ( test_properties_color_argb ) { widget wid; @@ -540,6 +696,262 @@ START_TEST ( test_properties_color_argb ) ck_assert_double_eq ( p->value.color.blue , 1 ); } END_TEST +START_TEST ( test_properties_color_hsl ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + rofi_theme_parse_string ( "* { test1: hsl(127,40%,66.66666%); test2: hsl(0, 100%, 50%); testa: hsl(127,40%, 66.66666%, 30%);}"); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + + Property *p = rofi_theme_find_property ( twid, P_COLOR, "test1", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 1.0 ); + ck_assert_double_eq_tol ( p->value.color.red , 0x88/255.0 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green, 0xcd/255.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0x90/255.0 , 0.004); + p = rofi_theme_find_property ( twid, P_COLOR, "test2", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 1.0 ); + ck_assert_double_eq_tol ( p->value.color.red , 1 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green , 0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0 , 0.004); + p = rofi_theme_find_property ( twid, P_COLOR, "testa", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.3 ); + ck_assert_double_eq_tol ( p->value.color.red , 0x88/255.0 ,0.004); + ck_assert_double_eq_tol ( p->value.color.green ,0xcd/255.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0x90/255.0 ,0.004); +} +END_TEST +START_TEST ( test_properties_color_hsla ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + rofi_theme_parse_string ( "* { test1: hsla(127,40%,66.66666%, 40%); test2: hsla(0, 100%, 50%,55%); }"); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + + Property *p = rofi_theme_find_property ( twid, P_COLOR, "test1", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.4 ); + ck_assert_double_eq_tol ( p->value.color.red , 0x88/255.0 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green , 0xcd/255.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0x90/255.0 , 0.004); + p = rofi_theme_find_property ( twid, P_COLOR, "test2", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.55 ); + ck_assert_double_eq_tol ( p->value.color.red , 1 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green , 0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0 , 0.004); +} +END_TEST +START_TEST ( test_properties_color_hsl_ws ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + rofi_theme_parse_string ( "* { test1: hsl(127 40% 66.66666%); test2: hsl(0 100% 50%); testa: hsl(127 40% 66.66666% / 30%);}"); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + + Property *p = rofi_theme_find_property ( twid, P_COLOR, "test1", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 1.0 ); + ck_assert_double_eq_tol ( p->value.color.red , 0x88/255.0 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green, 0xcd/255.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0x90/255.0 , 0.004); + p = rofi_theme_find_property ( twid, P_COLOR, "test2", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 1.0 ); + ck_assert_double_eq_tol ( p->value.color.red , 1 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green , 0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0 , 0.004); + p = rofi_theme_find_property ( twid, P_COLOR, "testa", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.3 ); + ck_assert_double_eq_tol ( p->value.color.red , 0x88/255.0 ,0.004); + ck_assert_double_eq_tol ( p->value.color.green ,0xcd/255.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0x90/255.0 ,0.004); +} +END_TEST +START_TEST ( test_properties_color_hsla_ws ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + rofi_theme_parse_string ( "* { test1: hsla(127 40% 66.66666% / 0.3); test2: hsla(0 100% 50%/ 55%); }"); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + + Property *p = rofi_theme_find_property ( twid, P_COLOR, "test1", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.3 ); + ck_assert_double_eq_tol ( p->value.color.red , 0x88/255.0 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green , 0xcd/255.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0x90/255.0 , 0.004); + p = rofi_theme_find_property ( twid, P_COLOR, "test2", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.55 ); + ck_assert_double_eq_tol ( p->value.color.red , 1 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green , 0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0 , 0.004); +} +END_TEST +START_TEST ( test_properties_color_hwb ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + rofi_theme_parse_string ( "* { test1: hwb(190,65%,0%); test2: hwb(265, 31%, 29%); testa: hwb(265, 31%, 29%, 40%); }"); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + + Property *p = rofi_theme_find_property ( twid, P_COLOR, "test2", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 1.0 ); + ck_assert_double_eq_tol ( p->value.color.red , 0x7a/255.0 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green , 0x4f/255.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0xb5/255.0 , 0.004); + p = rofi_theme_find_property ( twid, P_COLOR, "test1", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 1.0 ); + ck_assert_double_eq_tol ( p->value.color.red , 166/255.0, 0.004); + ck_assert_double_eq_tol ( p->value.color.green ,240/255.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 255/255.0 , 0.004); + p = rofi_theme_find_property ( twid, P_COLOR, "testa", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.4 ); + ck_assert_double_eq_tol ( p->value.color.red , 0x7a/255.0 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green , 0x4f/255.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0xb5/255.0 , 0.004); +} +END_TEST +START_TEST ( test_properties_color_hwb_ws ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + rofi_theme_parse_string ( "* { test1: hwb(190 deg 65 %0%); test2: hwb(295 grad 31% 29%);testa: hwb(0.736 turn 31% 29% / 40%); rada: hwb(0.2 rad 30% 30%/40%); }"); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + + Property *p = rofi_theme_find_property ( twid, P_COLOR, "test2", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 1.0 ); + ck_assert_double_eq_tol ( p->value.color.red , 0x7a/255.0 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green , 0x4f/255.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0xb5/255.0 , 0.004); + p = rofi_theme_find_property ( twid, P_COLOR, "test1", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 1.0 ); + ck_assert_double_eq_tol ( p->value.color.red , 166/255.0, 0.004); + ck_assert_double_eq_tol ( p->value.color.green ,240/255.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 255/255.0 , 0.004); + p = rofi_theme_find_property ( twid, P_COLOR, "testa", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.4 ); + ck_assert_double_eq_tol ( p->value.color.red , 0x7a/255.0 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green , 0x4f/255.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0xb5/255.0 , 0.004); + p = rofi_theme_find_property ( twid, P_COLOR, "rada", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.4 ); + ck_assert_double_eq_tol ( p->value.color.red , 0.7 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green , 0.376, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0.3 , 0.004); +} +END_TEST +START_TEST ( test_properties_color_cmyk ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + rofi_theme_parse_string ( "* { test1: cmyk ( 41%, 0%, 100%, 0%); test2: cmyk ( 0, 1.0, 1.0, 0);}"); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + + Property *p = rofi_theme_find_property ( twid, P_COLOR, "test1", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 1.0 ); + ck_assert_double_eq_tol ( p->value.color.red , 0x96/255.0 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green , 1.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0.0 , 0.004); + p = rofi_theme_find_property ( twid, P_COLOR, "test2", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 1.0 ); + ck_assert_double_eq_tol ( p->value.color.red , 1 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green , 0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0 , 0.004); +} +END_TEST +START_TEST ( test_properties_color_cmyk_ws ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + rofi_theme_parse_string ( "* { test1: cmyk ( 41% 0% 100% 0%); test2: cmyk ( 0 1.0 1.0 0);}"); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + + Property *p = rofi_theme_find_property ( twid, P_COLOR, "test1", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 1.0 ); + ck_assert_double_eq_tol ( p->value.color.red , 0x96/255.0 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green , 1.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0.0 , 0.004); + p = rofi_theme_find_property ( twid, P_COLOR, "test2", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 1.0 ); + ck_assert_double_eq_tol ( p->value.color.red , 1 , 0.004); + ck_assert_double_eq_tol ( p->value.color.green , 0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0 , 0.004); +} +END_TEST +START_TEST ( test_properties_color_names ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + for ( unsigned int iter = 0; iter < num_CSSColors; iter++ ) { + char * str = g_strdup_printf("* { color: %s;}", CSSColors[iter].name); + rofi_theme_parse_string(str); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + Property *p = rofi_theme_find_property ( twid, P_COLOR, "color", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 1.0 ); + ck_assert_double_eq_tol ( p->value.color.red , CSSColors[iter].r/255.0, 0.004); + ck_assert_double_eq_tol ( p->value.color.green, CSSColors[iter].g/255.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , CSSColors[iter].b/255.0, 0.004); + + g_free ( str ); + } + { + rofi_theme_parse_string("* {color: transparent;}"); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + Property *p = rofi_theme_find_property ( twid, P_COLOR, "color", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , 0.0 ); + ck_assert_double_eq_tol ( p->value.color.red , 0.0, 0.004); + ck_assert_double_eq_tol ( p->value.color.green, 0.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , 0.0, 0.004); + } +} +END_TEST +START_TEST ( test_properties_color_names_alpha ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + for ( unsigned int iter = 0; iter < num_CSSColors; iter++ ) { + char * str = g_strdup_printf("* { color: %s / %d %%;}", CSSColors[iter].name, iter%101); + rofi_theme_parse_string(str); + ThemeWidget *twid = rofi_theme_find_widget ( wid.name, wid.state, FALSE ); + Property *p = rofi_theme_find_property ( twid, P_COLOR, "color", FALSE ); + ck_assert_ptr_nonnull ( p ); + ck_assert_double_eq ( p->value.color.alpha , (iter%101)/100.0); + ck_assert_double_eq_tol ( p->value.color.red , CSSColors[iter].r/255.0, 0.004); + ck_assert_double_eq_tol ( p->value.color.green, CSSColors[iter].g/255.0, 0.004 ); + ck_assert_double_eq_tol ( p->value.color.blue , CSSColors[iter].b/255.0, 0.004); + + g_free ( str ); + } +} +END_TEST START_TEST ( test_properties_padding_2 ) { widget wid; @@ -672,6 +1084,49 @@ START_TEST ( test_import_empty) } END_TEST +START_TEST ( test_core_properties_error ) +{ + rofi_theme_parse_string ( " * { test: cmky(a,e,3); }"); + const char *errstr = "Error while parsing theme: * { test: cmky(a,e,3); }\n"\ + " Parser error: syntax error, unexpected invalid property value\n"\ + " Location: line 1 column 11 to line 1 column 23\n"; + ck_assert_int_eq ( error, 1); + ck_assert_str_eq ( error_msg->str, errstr ); + g_string_free ( error_msg, TRUE); + error_msg = NULL; + error = 0; + + const char *errstr2 = "Error while parsing theme: \n"\ + " Parser error: Value out of range: \n"\ + " Value: X = 500.00;\n"\ + " Range: 0.00 <= X <= 360.00.\n"\ + " Location: line 0 column 15 to line 0 column 18\n"; + rofi_theme_parse_string ( " * { test: hsl(500, 100% 10% ); }"); + ck_assert_int_eq ( error, 1); + ck_assert_str_eq ( error_msg->str, errstr2 ); + g_string_free ( error_msg, TRUE); + error_msg = NULL; + error = 0; + +} +END_TEST + +START_TEST ( test_import_error ) +{ + + rofi_theme_parse_string("@import \"/non-existing-file.rasi\""); + + const char *errstr = + "Failed to open theme: /non-existing-file.rasi\n"\ + "Error: No such file or directory"; + ck_assert_int_eq ( error, 1); + ck_assert_str_eq ( error_msg->str, errstr ); + g_string_free ( error_msg, TRUE); + error_msg = NULL; + error = 0; +} +END_TEST + static Suite * theme_parser_suite (void) { Suite *s; @@ -689,6 +1144,7 @@ static Suite * theme_parser_suite (void) tcase_add_test(tc_core, test_core_error_root ); tcase_add_test(tc_core, test_core_comments ); tcase_add_test(tc_core, test_core_newline ); + tcase_add_test(tc_core, test_core_properties_error ); suite_add_tcase(s, tc_core); } { @@ -727,11 +1183,26 @@ static Suite * theme_parser_suite (void) TCase *tc_prop_color = tcase_create("PropertiesColor"); tcase_add_checked_fixture(tc_prop_color, theme_parser_setup, theme_parser_teardown); tcase_add_test ( tc_prop_color, test_properties_color_h3); + tcase_add_test ( tc_prop_color, test_properties_color_h4); tcase_add_test ( tc_prop_color, test_properties_color_h6); tcase_add_test ( tc_prop_color, test_properties_color_h8); tcase_add_test ( tc_prop_color, test_properties_color_rgb); tcase_add_test ( tc_prop_color, test_properties_color_rgba); + tcase_add_test ( tc_prop_color, test_properties_color_rgba_percent); + tcase_add_test ( tc_prop_color, test_properties_color_rgb_p); + tcase_add_test ( tc_prop_color, test_properties_color_rgba_p); + tcase_add_test ( tc_prop_color, test_properties_color_rgba_percent_p); tcase_add_test ( tc_prop_color, test_properties_color_argb); + tcase_add_test ( tc_prop_color, test_properties_color_hsl); + tcase_add_test ( tc_prop_color, test_properties_color_hsla); + tcase_add_test ( tc_prop_color, test_properties_color_hsl_ws); + tcase_add_test ( tc_prop_color, test_properties_color_hsla_ws); + tcase_add_test ( tc_prop_color, test_properties_color_hwb); + tcase_add_test ( tc_prop_color, test_properties_color_hwb_ws); + tcase_add_test ( tc_prop_color, test_properties_color_cmyk); + tcase_add_test ( tc_prop_color, test_properties_color_cmyk_ws); + tcase_add_test ( tc_prop_color, test_properties_color_names); + tcase_add_test ( tc_prop_color, test_properties_color_names_alpha); suite_add_tcase(s, tc_prop_color ); } { @@ -778,6 +1249,7 @@ static Suite * theme_parser_suite (void) TCase *tc_prop_import = tcase_create("Import"); tcase_add_checked_fixture(tc_prop_import, theme_parser_setup, theme_parser_teardown); tcase_add_test ( tc_prop_import, test_import_empty); + tcase_add_test ( tc_prop_import, test_import_error); suite_add_tcase(s, tc_prop_import ); } return s; @@ -792,7 +1264,7 @@ int main ( int argc, char ** argv ) return EXIT_FAILURE; } - + Suite *s; SRunner *sr; diff --git a/themes/Adapta-Nokto.rasi b/themes/Adapta-Nokto.rasi index 8dd4bc38..0738fb5d 100644 --- a/themes/Adapta-Nokto.rasi +++ b/themes/Adapta-Nokto.rasi @@ -10,9 +10,9 @@ } #window { border: 2; - foreground: #FFC3C6C8; + foreground: #C3C6C8FF; padding: 5; - background: #FF3A4C54; + background: #3A4C54FF; } #window.mainbox { border: 0; @@ -23,8 +23,8 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FFFAFBFC; - background: #FF455A64; + foreground: #FAFBFCFF; + background: #455A64FF; } #window.mainbox.listview { fixed-height: 1; @@ -36,40 +36,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FFFAFBFC; - background: #FF455A64; + foreground: #FAFBFCFF; + background: #455A64FF; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFFF5252; - background: #FF455A64; + foreground: #FF5252FF; + background: #455A64FF; } #window.mainbox.listview.element.normal.active { - foreground: #FF00BCD4; - background: #FF455A64; + foreground: #00BCD4FF; + background: #455A64FF; } #window.mainbox.listview.element.selected.normal { - foreground: #FFFAFBFC; - background: #FF00BCD4; + foreground: #FAFBFCFF; + background: #00BCD4FF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FFFDF6E3; - background: #FFFF5252; + foreground: #FDF6E3FF; + background: #FF5252FF; } #window.mainbox.listview.element.selected.active { - foreground: #FFFDF6E3; - background: #FF009688; + foreground: #FDF6E3FF; + background: #009688FF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FFFAFBFC; - background: #FF455A64; + foreground: #FAFBFCFF; + background: #455A64FF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFFF5252; - background: #FF455A64; + foreground: #FF5252FF; + background: #455A64FF; } #window.mainbox.listview.element.alternate.active { - foreground: #FF00BCD4; - background: #FF455A64; + foreground: #00BCD4FF; + background: #455A64FF; } #window.mainbox.listview.scrollbar { border: 0; @@ -84,6 +84,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FFFAFBFC; - background: #FF455A64; + foreground: #FAFBFCFF; + background: #455A64FF; } diff --git a/themes/Arc.rasi b/themes/Arc.rasi index b58be36b..dfdbd476 100644 --- a/themes/Arc.rasi +++ b/themes/Arc.rasi @@ -10,7 +10,7 @@ } #window { border: 2; - foreground: #FFF5F5F5; + foreground: #F5F5F5FF; padding: 5; background: #FFFFFFFF; } @@ -23,7 +23,7 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FF525D76; + foreground: #525D76FF; background: #FFFFFFFF; } #window.mainbox.listview { @@ -36,40 +36,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FF525D76; + foreground: #525D76FF; background: #FFFFFFFF; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFDC322F; + foreground: #DC322FFF; background: #FFFFFFFF; } #window.mainbox.listview.element.normal.active { - foreground: #FFC2CAD0; + foreground: #C2CAD0FF; background: #FFFFFFFF; } #window.mainbox.listview.element.selected.normal { foreground: #FFFFFFFF; - background: #FF5294E2; + background: #5294E2FF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FFDC322F; - background: #FF5294E2; + foreground: #DC322FFF; + background: #5294E2FF; } #window.mainbox.listview.element.selected.active { - foreground: #FFC2CAD0; - background: #FF5294E2; + foreground: #C2CAD0FF; + background: #5294E2FF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FF525D76; - background: #FFF5F5F5; + foreground: #525D76FF; + background: #F5F5F5FF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFDC322F; - background: #FFF5F5F5; + foreground: #DC322FFF; + background: #F5F5F5FF; } #window.mainbox.listview.element.alternate.active { - foreground: #FFC2CAD0; - background: #FFF5F5F5; + foreground: #C2CAD0FF; + background: #F5F5F5FF; } #window.mainbox.listview.scrollbar { border: 0; @@ -84,6 +84,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FF525D76; + foreground: #525D76FF; background: #FFFFFFFF; } diff --git a/themes/DarkBlue.rasi b/themes/DarkBlue.rasi index 5f6bdd3d..f7f0357b 100644 --- a/themes/DarkBlue.rasi +++ b/themes/DarkBlue.rasi @@ -10,9 +10,9 @@ } #window { border: 2; - foreground: #FFDBDFBC; + foreground: #DBDFBCFF; padding: 5; - background: #DD000021; + background: #000021DD; } #window.mainbox { border: 0; @@ -23,7 +23,7 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FFDBDFBC; + foreground: #DBDFBCFF; background: #00000000; } #window.mainbox.listview { @@ -36,39 +36,39 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FFDBDFBC; + foreground: #DBDFBCFF; background: #00000000; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFFF81FF; + foreground: #FF81FFFF; background: #00000000; } #window.mainbox.listview.element.normal.active { - foreground: #FF8AC4FF; + foreground: #8AC4FFFF; background: #00000000; } #window.mainbox.listview.element.selected.normal { - foreground: #FF02143F; - background: #FFDBDFBC; + foreground: #02143FFF; + background: #DBDFBCFF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FF02143F; - background: #FFFF817F; + foreground: #02143FFF; + background: #FF817FFF; } #window.mainbox.listview.element.selected.active { - foreground: #FF02143F; - background: #FF8AC4FF; + foreground: #02143FFF; + background: #8AC4FFFF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FFDBDFBC; + foreground: #DBDFBCFF; background: #00000000; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFFF81FF; + foreground: #FF81FFFF; background: #00000000; } #window.mainbox.listview.element.alternate.active { - foreground: #FF8AC4FF; + foreground: #8AC4FFFF; background: #00000000; } #window.mainbox.listview.scrollbar { @@ -80,8 +80,8 @@ } #window.mainbox.sidebar.button selected{ border: 2px 0px 0px ; - foreground: #FF02143F; - background: #FFDBDFBC; + foreground: #02143FFF; + background: #DBDFBCFF; } #window.mainbox.inputbar { spacing: 0; @@ -89,6 +89,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FFDBDFBC; + foreground: #DBDFBCFF; background: #00000000; } diff --git a/themes/Indego.rasi b/themes/Indego.rasi index ea74ed68..04cec9c5 100644 --- a/themes/Indego.rasi +++ b/themes/Indego.rasi @@ -10,9 +10,9 @@ } #window { border: 2; - foreground: #FFE8EAF6; + foreground: #E8EAF6FF; padding: 5; - background: #FF1A237E; + background: #1A237EFF; } #window.mainbox { border: 0; @@ -23,8 +23,8 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FFE8EAF6; - background: #007986CB; + foreground: #E8EAF6FF; + background: #7986CB00; } #window.mainbox.listview { fixed-height: 1; @@ -36,40 +36,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FFE8EAF6; - background: #007986CB; + foreground: #E8EAF6FF; + background: #7986CB00; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFFFCDD2; - background: #00FDF6E3; + foreground: #FFCDD2FF; + background: #FDF6E300; } #window.mainbox.listview.element.normal.active { - foreground: #FFB2EBF2; - background: #00FDF6E3; + foreground: #B2EBF2FF; + background: #FDF6E300; } #window.mainbox.listview.element.selected.normal { - foreground: #FFE8EAF6; - background: #FF3F51B5; + foreground: #E8EAF6FF; + background: #3F51B5FF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FFB71C1C; - background: #FFFFCDD2; + foreground: #B71C1CFF; + background: #FFCDD2FF; } #window.mainbox.listview.element.selected.active { - foreground: #FF006064; - background: #FFB2EBF2; + foreground: #006064FF; + background: #B2EBF2FF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FFE8EAF6; - background: #FF283593; + foreground: #E8EAF6FF; + background: #283593FF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFFFCDD2; - background: #FFB71C1C; + foreground: #FFCDD2FF; + background: #B71C1CFF; } #window.mainbox.listview.element.alternate.active { - foreground: #FFB2EBF2; - background: #FF006064; + foreground: #B2EBF2FF; + background: #006064FF; } #window.mainbox.listview.scrollbar { border: 0; @@ -84,6 +84,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FFE8EAF6; - background: #007986CB; + foreground: #E8EAF6FF; + background: #7986CB00; } diff --git a/themes/Monokai.rasi b/themes/Monokai.rasi index b1b0072e..98349dab 100644 --- a/themes/Monokai.rasi +++ b/themes/Monokai.rasi @@ -10,9 +10,9 @@ } #window { border: 2; - foreground: #FFE6DB74; + foreground: #E6DB74FF; padding: 5; - background: #EE272822; + background: #272822EE; } #window.mainbox { border: 0; @@ -23,8 +23,8 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FFF8F8F2; - background: #00272822; + foreground: #F8F8F2FF; + background: #27282200; } #window.mainbox.listview { fixed-height: 1; @@ -36,40 +36,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FFF8F8F2; - background: #00272822; + foreground: #F8F8F2FF; + background: #27282200; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFF92672; - background: #00272822; + foreground: #F92672FF; + background: #27282200; } #window.mainbox.listview.element.normal.active { - foreground: #FFA6E22A; - background: #00272822; + foreground: #A6E22AFF; + background: #27282200; } #window.mainbox.listview.element.selected.normal { - foreground: #FFF8F8F2; - background: #FF141411; + foreground: #F8F8F2FF; + background: #141411FF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FFF8F8F2; - background: #FFF92672; + foreground: #F8F8F2FF; + background: #F92672FF; } #window.mainbox.listview.element.selected.active { - foreground: #FFA6E22A; - background: #FF141411; + foreground: #A6E22AFF; + background: #141411FF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FFF8F8F2; - background: #00272822; + foreground: #F8F8F2FF; + background: #27282200; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFF92672; - background: #00272822; + foreground: #F92672FF; + background: #27282200; } #window.mainbox.listview.element.alternate.active { - foreground: #FFA6E22A; - background: #00272822; + foreground: #A6E22AFF; + background: #27282200; } #window.mainbox.listview.scrollbar { border: 0; @@ -84,6 +84,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FFF8F8F2; - background: #00272822; + foreground: #F8F8F2FF; + background: #27282200; } diff --git a/themes/Paper.rasi b/themes/Paper.rasi index 2622d809..005cb88a 100644 --- a/themes/Paper.rasi +++ b/themes/Paper.rasi @@ -10,9 +10,9 @@ } #window { border: 2; - foreground: #FF444444; + foreground: #444444FF; padding: 5; - background: #FFF5F5F5; + background: #F5F5F5FF; } #window.mainbox { border: 0; @@ -23,8 +23,8 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FF002B36; - background: #00F5F5F5; + foreground: #002B36FF; + background: #F5F5F500; } #window.mainbox.listview { fixed-height: 1; @@ -36,40 +36,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FF002B36; - background: #00F5F5F5; + foreground: #002B36FF; + background: #F5F5F500; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFD75F00; - background: #FFF5F5F5; + foreground: #D75F00FF; + background: #F5F5F5FF; } #window.mainbox.listview.element.normal.active { - foreground: #FF005F87; - background: #FFF5F5F5; + foreground: #005F87FF; + background: #F5F5F5FF; } #window.mainbox.listview.element.selected.normal { - foreground: #FFF5F5F5; - background: #FF4271AE; + foreground: #F5F5F5FF; + background: #4271AEFF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FFF5F5F5; - background: #FFD75F00; + foreground: #F5F5F5FF; + background: #D75F00FF; } #window.mainbox.listview.element.selected.active { - foreground: #FFF5F5F5; - background: #FF005F87; + foreground: #F5F5F5FF; + background: #005F87FF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FF002B36; - background: #FFD0D0D0; + foreground: #002B36FF; + background: #D0D0D0FF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFD75F00; - background: #FFD0D0D0; + foreground: #D75F00FF; + background: #D0D0D0FF; } #window.mainbox.listview.element.alternate.active { - foreground: #FF005F87; - background: #FFD0D0D0; + foreground: #005F87FF; + background: #D0D0D0FF; } #window.mainbox.listview.scrollbar { border: 0; @@ -84,6 +84,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FF002B36; - background: #00F5F5F5; + foreground: #002B36FF; + background: #F5F5F500; } diff --git a/themes/android_notification.rasi b/themes/android_notification.rasi index 3cda7abf..6a5eeca5 100644 --- a/themes/android_notification.rasi +++ b/themes/android_notification.rasi @@ -9,9 +9,9 @@ } #window { border: 2; - foreground: #FF1E2529; + foreground: #1E2529FF; padding: 5; - background: #FF273238; + background: #273238FF; } #window.mainbox { border: 0; @@ -22,8 +22,8 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FFC1C1C1; - background: #FF273238; + foreground: #C1C1C1FF; + background: #273238FF; } #window.mainbox.listview { fixed-height: 1; @@ -35,40 +35,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FFC1C1C1; - background: #FF273238; + foreground: #C1C1C1FF; + background: #273238FF; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFFF1844; - background: #FF273238; + foreground: #FF1844FF; + background: #273238FF; } #window.mainbox.listview.element.normal.active { - foreground: #FF80CBC4; - background: #FF273238; + foreground: #80CBC4FF; + background: #273238FF; } #window.mainbox.listview.element.selected.normal { foreground: #FFFFFFFF; - background: #FF394249; + background: #394249FF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FFFF1844; - background: #FF394249; + foreground: #FF1844FF; + background: #394249FF; } #window.mainbox.listview.element.selected.active { - foreground: #FF80CBC4; - background: #FF394249; + foreground: #80CBC4FF; + background: #394249FF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FFC1C1C1; - background: #FF273238; + foreground: #C1C1C1FF; + background: #273238FF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFFF1844; - background: #FF273238; + foreground: #FF1844FF; + background: #273238FF; } #window.mainbox.listview.element.alternate.active { - foreground: #FF80CBC4; - background: #FF273238; + foreground: #80CBC4FF; + background: #273238FF; } #window.mainbox.listview.scrollbar { border: 0; @@ -83,6 +83,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FFC1C1C1; - background: #FF273238; + foreground: #C1C1C1FF; + background: #273238FF; } diff --git a/themes/arthur.rasi b/themes/arthur.rasi index 3d9dc112..e678df6c 100644 --- a/themes/arthur.rasi +++ b/themes/arthur.rasi @@ -50,7 +50,7 @@ border: 1px; border-radius: 15px; foreground: @magenta; - background: #cc1c1c1c; + background: #1c1c1ccc; } diff --git a/themes/blue.rasi b/themes/blue.rasi index 91601228..df4e6374 100644 --- a/themes/blue.rasi +++ b/themes/blue.rasi @@ -10,9 +10,9 @@ } #window { border: 2; - foreground: #FF00B0EF; + foreground: #00B0EFFF; padding: 5; - background: #EE0060A0; + background: #0060A0EE; } #window.mainbox { border: 0; @@ -23,7 +23,7 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FF00B0EF; + foreground: #00B0EFFF; background: #00000000; } #window.mainbox.listview { @@ -36,39 +36,39 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FF00B0EF; + foreground: #00B0EFFF; background: #00000000; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFFFA0A0; + foreground: #FFA0A0FF; background: #00000000; } #window.mainbox.listview.element.normal.active { - foreground: #FFA0FFA0; + foreground: #A0FFA0FF; background: #00000000; } #window.mainbox.listview.element.selected.normal { - foreground: #FF0060A0; - background: #FF00B0EF; + foreground: #0060A0FF; + background: #00B0EFFF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FF0060A0; - background: #FFFFA0A0; + foreground: #0060A0FF; + background: #FFA0A0FF; } #window.mainbox.listview.element.selected.active { - foreground: #FF0060A0; - background: #FFA0FFA0; + foreground: #0060A0FF; + background: #A0FFA0FF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FF00B0EF; + foreground: #00B0EFFF; background: #00000000; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFFFA0A0; + foreground: #FFA0A0FF; background: #00000000; } #window.mainbox.listview.element.alternate.active { - foreground: #FFA0FFA0; + foreground: #A0FFA0FF; background: #00000000; } #window.mainbox.listview.scrollbar { @@ -84,6 +84,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FF00B0EF; + foreground: #00B0EFFF; background: #00000000; } diff --git a/themes/c64.rasi b/themes/c64.rasi index d6d34b13..61f6bf52 100644 --- a/themes/c64.rasi +++ b/themes/c64.rasi @@ -9,9 +9,9 @@ } #window { border: 2; - foreground: #FF4F80FF; + foreground: #4F80FFFF; padding: 5; - background: #FF0039FF; + background: #0039FFFF; } #window.mainbox { border: 0; @@ -22,8 +22,8 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FF4F80FF; - background: #FF0039FF; + foreground: #4F80FFFF; + background: #0039FFFF; } #window.mainbox.listview { fixed-height: 1; @@ -35,40 +35,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FF4F80FF; - background: #FF0039FF; + foreground: #4F80FFFF; + background: #0039FFFF; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFFF7047; - background: #FF0039FF; + foreground: #FF7047FF; + background: #0039FFFF; } #window.mainbox.listview.element.normal.active { - foreground: #FF68BA50; - background: #FF0039FF; + foreground: #68BA50FF; + background: #0039FFFF; } #window.mainbox.listview.element.selected.normal { foreground: #FFFFFFFF; - background: #FF4F80FF; + background: #4F80FFFF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FFFF7047; - background: #FF4F80FF; + foreground: #FF7047FF; + background: #4F80FFFF; } #window.mainbox.listview.element.selected.active { - foreground: #FF68BA50; - background: #FF4F80FF; + foreground: #68BA50FF; + background: #4F80FFFF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FF4F80FF; - background: #FF0039FF; + foreground: #4F80FFFF; + background: #0039FFFF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFFF7047; - background: #FF0039FF; + foreground: #FF7047FF; + background: #0039FFFF; } #window.mainbox.listview.element.alternate.active { - foreground: #FF68BA50; - background: #FF0039FF; + foreground: #68BA50FF; + background: #0039FFFF; } #window.mainbox.listview.scrollbar { border: 0; @@ -83,6 +83,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FF4F80FF; - background: #FF0039FF; + foreground: #4F80FFFF; + background: #0039FFFF; } diff --git a/themes/glue_pro_blue.rasi b/themes/glue_pro_blue.rasi index 1ed613fa..883d4fa1 100644 --- a/themes/glue_pro_blue.rasi +++ b/themes/glue_pro_blue.rasi @@ -9,9 +9,9 @@ } #window { border: 2; - foreground: #FF268BD2; + foreground: #268BD2FF; padding: 5; - background: #FF393939; + background: #393939FF; } #window.mainbox { border: 0; @@ -23,7 +23,7 @@ } #window.mainbox.message.normal { foreground: #FFFFFFFF; - background: #FF393939; + background: #393939FF; } #window.mainbox.listview { fixed-height: 1; @@ -36,39 +36,39 @@ } #window.mainbox.listview.element.normal.normal { foreground: #FFFFFFFF; - background: #FF393939; + background: #393939FF; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFF3843D; - background: #FF393939; + foreground: #F3843DFF; + background: #393939FF; } #window.mainbox.listview.element.normal.active { - foreground: #FF268BD2; - background: #FF393939; + foreground: #268BD2FF; + background: #393939FF; } #window.mainbox.listview.element.selected.normal { foreground: #FFFFFFFF; - background: #FF268BD2; + background: #268BD2FF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FFFFC39C; - background: #FF268BD2; + foreground: #FFC39CFF; + background: #268BD2FF; } #window.mainbox.listview.element.selected.active { - foreground: #FF205171; - background: #FF268BD2; + foreground: #205171FF; + background: #268BD2FF; } #window.mainbox.listview.element.alternate.normal { foreground: #FFFFFFFF; - background: #FF393939; + background: #393939FF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFF3843D; - background: #FF393939; + foreground: #F3843DFF; + background: #393939FF; } #window.mainbox.listview.element.alternate.active { - foreground: #FF268BD2; - background: #FF393939; + foreground: #268BD2FF; + background: #393939FF; } #window.mainbox.listview.scrollbar { border: 0; @@ -84,5 +84,5 @@ } #window.mainbox.inputbar.normal { foreground: #FFFFFFFF; - background: #FF393939; + background: #393939FF; } diff --git a/themes/gruvbox-dark-hard.rasi b/themes/gruvbox-dark-hard.rasi index eed3eb8b..b06c6ad1 100644 --- a/themes/gruvbox-dark-hard.rasi +++ b/themes/gruvbox-dark-hard.rasi @@ -16,9 +16,9 @@ } #window { border: 2; - foreground: #FFA89984; + foreground: #A89984FF; padding: 5; - background: #FF1D2021; + background: #1D2021FF; } #window.mainbox { border: 0; @@ -29,8 +29,8 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FFEBDBB2; - background: #FF1D2021; + foreground: #EBDBB2FF; + background: #1D2021FF; } #window.mainbox.listview { fixed-height: 1; @@ -42,40 +42,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FFEBDBB2; - background: #FF1D2021; + foreground: #EBDBB2FF; + background: #1D2021FF; } #window.mainbox.listview.element.normal.urgent { - foreground: #FF1D2021; - background: #FFCC241D; + foreground: #1D2021FF; + background: #CC241DFF; } #window.mainbox.listview.element.normal.active { - foreground: #FF1D2021; - background: #FFD79921; + foreground: #1D2021FF; + background: #D79921FF; } #window.mainbox.listview.element.selected.normal { - foreground: #FFFBF1C7; - background: #FF504945; + foreground: #FBF1C7FF; + background: #504945FF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FF1D2021; - background: #FFFB4934; + foreground: #1D2021FF; + background: #FB4934FF; } #window.mainbox.listview.element.selected.active { - foreground: #FF1D2021; - background: #FFFABD2F; + foreground: #1D2021FF; + background: #FABD2FFF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FFEBDBB2; - background: #FF282828; + foreground: #EBDBB2FF; + background: #282828FF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FF1D2021; - background: #FFCC241D; + foreground: #1D2021FF; + background: #CC241DFF; } #window.mainbox.listview.element.alternate.active { - foreground: #FF1D2021; - background: #FFD79921; + foreground: #1D2021FF; + background: #D79921FF; } #window.mainbox.listview.scrollbar { border: 0; @@ -90,6 +90,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FFEBDBB2; - background: #FF1D2021; + foreground: #EBDBB2FF; + background: #1D2021FF; } diff --git a/themes/gruvbox-dark-soft.rasi b/themes/gruvbox-dark-soft.rasi index 58cb59e8..9b150a3f 100644 --- a/themes/gruvbox-dark-soft.rasi +++ b/themes/gruvbox-dark-soft.rasi @@ -16,9 +16,9 @@ } #window { border: 2; - foreground: #FFA89984; + foreground: #A89984FF; padding: 5; - background: #FF32302F; + background: #32302FFF; } #window.mainbox { border: 0; @@ -29,8 +29,8 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FFEBDBB2; - background: #FF32302F; + foreground: #EBDBB2FF; + background: #32302FFF; } #window.mainbox.listview { fixed-height: 1; @@ -42,40 +42,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FFEBDBB2; - background: #FF32302F; + foreground: #EBDBB2FF; + background: #32302FFF; } #window.mainbox.listview.element.normal.urgent { - foreground: #FF32302F; - background: #FFCC241D; + foreground: #32302FFF; + background: #CC241DFF; } #window.mainbox.listview.element.normal.active { - foreground: #FF32302F; - background: #FFD79921; + foreground: #32302FFF; + background: #D79921FF; } #window.mainbox.listview.element.selected.normal { - foreground: #FFFBF1C7; - background: #FF665C54; + foreground: #FBF1C7FF; + background: #665C54FF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FF32302F; - background: #FFFB4934; + foreground: #32302FFF; + background: #FB4934FF; } #window.mainbox.listview.element.selected.active { - foreground: #FF32302F; - background: #FFFABD2F; + foreground: #32302FFF; + background: #FABD2FFF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FFEBDBB2; - background: #FF3C3836; + foreground: #EBDBB2FF; + background: #3C3836FF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FF32302F; - background: #FFCC241D; + foreground: #32302FFF; + background: #CC241DFF; } #window.mainbox.listview.element.alternate.active { - foreground: #FF32302F; - background: #FFD79921; + foreground: #32302FFF; + background: #D79921FF; } #window.mainbox.listview.scrollbar { border: 0; @@ -90,6 +90,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FFEBDBB2; - background: #FF32302F; + foreground: #EBDBB2FF; + background: #32302FFF; } diff --git a/themes/gruvbox-dark.rasi b/themes/gruvbox-dark.rasi index 0689d9f2..c02f5ecf 100644 --- a/themes/gruvbox-dark.rasi +++ b/themes/gruvbox-dark.rasi @@ -16,9 +16,9 @@ } #window { border: 2; - foreground: #FFA89984; + foreground: #A89984FF; padding: 5; - background: #FF282828; + background: #282828FF; } #window.mainbox { border: 0; @@ -29,8 +29,8 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FFEBDBB2; - background: #FF282828; + foreground: #EBDBB2FF; + background: #282828FF; } #window.mainbox.listview { fixed-height: 1; @@ -42,40 +42,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FFEBDBB2; - background: #FF282828; + foreground: #EBDBB2FF; + background: #282828FF; } #window.mainbox.listview.element.normal.urgent { - foreground: #FF282828; - background: #FFCC241D; + foreground: #282828FF; + background: #CC241DFF; } #window.mainbox.listview.element.normal.active { - foreground: #FF282828; - background: #FFD79921; + foreground: #282828FF; + background: #D79921FF; } #window.mainbox.listview.element.selected.normal { - foreground: #FFFBF1C7; - background: #FF665C54; + foreground: #FBF1C7FF; + background: #665C54FF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FF282828; - background: #FFFB4934; + foreground: #282828FF; + background: #FB4934FF; } #window.mainbox.listview.element.selected.active { - foreground: #FF282828; - background: #FFFABD2F; + foreground: #282828FF; + background: #FABD2FFF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FFEBDBB2; - background: #FF32302F; + foreground: #EBDBB2FF; + background: #32302FFF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FF282828; - background: #FFCC241D; + foreground: #282828FF; + background: #CC241DFF; } #window.mainbox.listview.element.alternate.active { - foreground: #FF282828; - background: #FFD79921; + foreground: #282828FF; + background: #D79921FF; } #window.mainbox.listview.scrollbar { border: 0; @@ -90,6 +90,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FFEBDBB2; - background: #FF282828; + foreground: #EBDBB2FF; + background: #282828FF; } diff --git a/themes/gruvbox-light-hard.rasi b/themes/gruvbox-light-hard.rasi index 6e76fdc4..bc9acafd 100644 --- a/themes/gruvbox-light-hard.rasi +++ b/themes/gruvbox-light-hard.rasi @@ -16,9 +16,9 @@ } #window { border: 2; - foreground: #FF7C6F64; + foreground: #7C6F64FF; padding: 5; - background: #FFF9F5D7; + background: #F9F5D7FF; } #window.mainbox { border: 0; @@ -29,8 +29,8 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FF3C3836; - background: #FFF9F5D7; + foreground: #3C3836FF; + background: #F9F5D7FF; } #window.mainbox.listview { fixed-height: 1; @@ -42,40 +42,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FF3C3836; - background: #FFF9F5D7; + foreground: #3C3836FF; + background: #F9F5D7FF; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFFDF4C1; - background: #FFCC241D; + foreground: #FDF4C1FF; + background: #CC241DFF; } #window.mainbox.listview.element.normal.active { - foreground: #FFFDF4C1; - background: #FFB57614; + foreground: #FDF4C1FF; + background: #B57614FF; } #window.mainbox.listview.element.selected.normal { - foreground: #FF282828; - background: #FFEBDBB2; + foreground: #282828FF; + background: #EBDBB2FF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FFFDF4C1; - background: #FFFB4934; + foreground: #FDF4C1FF; + background: #FB4934FF; } #window.mainbox.listview.element.selected.active { - foreground: #FFFDF4C1; - background: #FFD79921; + foreground: #FDF4C1FF; + background: #D79921FF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FF3C3836; - background: #FFFBF1C7; + foreground: #3C3836FF; + background: #FBF1C7FF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFFDF4C1; - background: #FFCC241D; + foreground: #FDF4C1FF; + background: #CC241DFF; } #window.mainbox.listview.element.alternate.active { - foreground: #FFFDF4C1; - background: #FFB57614; + foreground: #FDF4C1FF; + background: #B57614FF; } #window.mainbox.listview.scrollbar { border: 0; @@ -90,6 +90,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FF3C3836; - background: #FFF9F5D7; + foreground: #3C3836FF; + background: #F9F5D7FF; } diff --git a/themes/gruvbox-light-soft.rasi b/themes/gruvbox-light-soft.rasi index 2ca5b332..25487697 100644 --- a/themes/gruvbox-light-soft.rasi +++ b/themes/gruvbox-light-soft.rasi @@ -16,9 +16,9 @@ } #window { border: 2; - foreground: #FF7C6F64; + foreground: #7C6F64FF; padding: 5; - background: #FFF2E5BC; + background: #F2E5BCFF; } #window.mainbox { border: 0; @@ -29,8 +29,8 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FF3C3836; - background: #FFF2E5BC; + foreground: #3C3836FF; + background: #F2E5BCFF; } #window.mainbox.listview { fixed-height: 1; @@ -42,40 +42,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FF3C3836; - background: #FFF2E5BC; + foreground: #3C3836FF; + background: #F2E5BCFF; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFF2E5BC; - background: #FFCC241D; + foreground: #F2E5BCFF; + background: #CC241DFF; } #window.mainbox.listview.element.normal.active { - foreground: #FFF2E5BC; - background: #FFB57614; + foreground: #F2E5BCFF; + background: #B57614FF; } #window.mainbox.listview.element.selected.normal { - foreground: #FF282828; - background: #FFD5C4A1; + foreground: #282828FF; + background: #D5C4A1FF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FFF2E5BC; - background: #FFFB4934; + foreground: #F2E5BCFF; + background: #FB4934FF; } #window.mainbox.listview.element.selected.active { - foreground: #FFF2E5BC; - background: #FFD79921; + foreground: #F2E5BCFF; + background: #D79921FF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FF3C3836; - background: #FFEBDBB2; + foreground: #3C3836FF; + background: #EBDBB2FF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFF2E5BC; - background: #FFCC241D; + foreground: #F2E5BCFF; + background: #CC241DFF; } #window.mainbox.listview.element.alternate.active { - foreground: #FFF2E5BC; - background: #FFB57614; + foreground: #F2E5BCFF; + background: #B57614FF; } #window.mainbox.listview.scrollbar { border: 0; @@ -90,6 +90,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FF3C3836; - background: #FFF2E5BC; + foreground: #3C3836FF; + background: #F2E5BCFF; } diff --git a/themes/gruvbox-light.rasi b/themes/gruvbox-light.rasi index f2b18009..b575d0ce 100644 --- a/themes/gruvbox-light.rasi +++ b/themes/gruvbox-light.rasi @@ -16,9 +16,9 @@ } #window { border: 2; - foreground: #FF7C6F64; + foreground: #7C6F64FF; padding: 5; - background: #FFFBF1C7; + background: #FBF1C7FF; } #window.mainbox { border: 0; @@ -29,8 +29,8 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FF3C3836; - background: #FFFBF1C7; + foreground: #3C3836FF; + background: #FBF1C7FF; } #window.mainbox.listview { fixed-height: 1; @@ -42,40 +42,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FF3C3836; - background: #FFFBF1C7; + foreground: #3C3836FF; + background: #FBF1C7FF; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFFBF1C7; - background: #FFCC241D; + foreground: #FBF1C7FF; + background: #CC241DFF; } #window.mainbox.listview.element.normal.active { - foreground: #FFFBF1C7; - background: #FFB57614; + foreground: #FBF1C7FF; + background: #B57614FF; } #window.mainbox.listview.element.selected.normal { - foreground: #FF282828; - background: #FFD5C4A1; + foreground: #282828FF; + background: #D5C4A1FF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FFFBF1C7; - background: #FFFB4934; + foreground: #FBF1C7FF; + background: #FB4934FF; } #window.mainbox.listview.element.selected.active { - foreground: #FFFBF1C7; - background: #FFD79921; + foreground: #FBF1C7FF; + background: #D79921FF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FF3C3836; - background: #FFF2E5BC; + foreground: #3C3836FF; + background: #F2E5BCFF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFFBF1C7; - background: #FFCC241D; + foreground: #FBF1C7FF; + background: #CC241DFF; } #window.mainbox.listview.element.alternate.active { - foreground: #FFFBF1C7; - background: #FFB57614; + foreground: #FBF1C7FF; + background: #B57614FF; } #window.mainbox.listview.scrollbar { border: 0; @@ -90,6 +90,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FF3C3836; - background: #FFFBF1C7; + foreground: #3C3836FF; + background: #FBF1C7FF; } diff --git a/themes/lb.rasi b/themes/lb.rasi index 54626dde..accc14a2 100644 --- a/themes/lb.rasi +++ b/themes/lb.rasi @@ -9,9 +9,9 @@ } #window { border: 2; - foreground: #FF10A0A0; + foreground: #10A0A0FF; padding: 5; - background: #EE333333; + background: #333333EE; } #window.mainbox { border: 0; @@ -22,7 +22,7 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FF10A0A0; + foreground: #10A0A0FF; background: #00000000; } #window.mainbox.listview { @@ -35,40 +35,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FF10A0A0; + foreground: #10A0A0FF; background: #00000000; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFF09090; + foreground: #F09090FF; background: #00000000; } #window.mainbox.listview.element.normal.active { - foreground: #FFA0A010; + foreground: #A0A010FF; background: #00000000; } #window.mainbox.listview.element.selected.normal { - foreground: #FF303030; - background: #FF10A0A0; + foreground: #303030FF; + background: #10A0A0FF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FF303030; - background: #FFF09090; + foreground: #303030FF; + background: #F09090FF; } #window.mainbox.listview.element.selected.active { - foreground: #FF303030; - background: #FFA0A010; + foreground: #303030FF; + background: #A0A010FF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FF10A0A0; - background: #11FFFFFF; + foreground: #10A0A0FF; + background: #FFFFFF11; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFF09090; - background: #11FFFFFF; + foreground: #F09090FF; + background: #FFFFFF11; } #window.mainbox.listview.element.alternate.active { - foreground: #FFA0A010; - background: #11FFFFFF; + foreground: #A0A010FF; + background: #FFFFFF11; } #window.mainbox.listview.scrollbar { border: 0; @@ -83,6 +83,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FF10A0A0; + foreground: #10A0A0FF; background: #00000000; } diff --git a/themes/paper-float.rasi b/themes/paper-float.rasi index 1a2e2a02..971dc068 100644 --- a/themes/paper-float.rasi +++ b/themes/paper-float.rasi @@ -20,7 +20,7 @@ background: #00000000; border: 0; padding: 0% 0% 1em 0%; - foreground: #FF444444; + foreground: #444444FF; x-offset: 0; y-offset: -10%; } @@ -38,7 +38,7 @@ foreground: @back; } #window.mainbox.message.normal { - foreground: #FF002B36; + foreground: #002B36FF; padding: 0; border: 0; } @@ -57,40 +57,40 @@ highlight: bold ; } #window.mainbox.listview.element.normal.normal { - foreground: #FF002B36; - background: #00F5F5F5; + foreground: #002B36FF; + background: #F5F5F500; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFD75F00; - background: #FFF5F5F5; + foreground: #D75F00FF; + background: #F5F5F5FF; } #window.mainbox.listview.element.normal.active { - foreground: #FF005F87; - background: #FFF5F5F5; + foreground: #005F87FF; + background: #F5F5F5FF; } #window.mainbox.listview.element.selected.normal { - foreground: #FFF5F5F5; - background: #FF4271AE; + foreground: #F5F5F5FF; + background: #4271AEFF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FFF5F5F5; - background: #FFD75F00; + foreground: #F5F5F5FF; + background: #D75F00FF; } #window.mainbox.listview.element.selected.active { - foreground: #FFF5F5F5; - background: #FF005F87; + foreground: #F5F5F5FF; + background: #005F87FF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FF002B36; - background: #FFD0D0D0; + foreground: #002B36FF; + background: #D0D0D0FF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFD75F00; - background: #FFD0D0D0; + foreground: #D75F00FF; + background: #D0D0D0FF; } #window.mainbox.listview.element.alternate.active { - foreground: #FF005F87; - background: #FFD0D0D0; + foreground: #005F87FF; + background: #D0D0D0FF; } #window.mainbox.listview.scrollbar { border: 0; @@ -106,8 +106,8 @@ index: 0; } #window.mainbox.inputbar.normal { - foreground: #FF002B36; - background: #00F5F5F5; + foreground: #002B36FF; + background: #F5F5F500; } #window.mainbox.sidebar.box { @@ -117,5 +117,5 @@ index: 10; } #window.mainbox.sidebar.button selected { - text: #FF4271AE; + text: #4271AEFF; } diff --git a/themes/purple.rasi b/themes/purple.rasi index 20b490af..06ffcc60 100644 --- a/themes/purple.rasi +++ b/themes/purple.rasi @@ -10,9 +10,9 @@ } #window { border: 2; - foreground: #2FEF6155; + foreground: #EF61552F; padding: 5; - background: #FF2F1E2E; + background: #2F1E2EFF; } #window.mainbox { border: 0; @@ -23,8 +23,8 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FFB4B4B4; - background: #A02F1E2E; + foreground: #B4B4B4FF; + background: #2F1E2EA0; } #window.mainbox.listview { fixed-height: 1; @@ -36,40 +36,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FFB4B4B4; - background: #A02F1E2E; + foreground: #B4B4B4FF; + background: #2F1E2EA0; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFEF6155; - background: #272F1E2E; + foreground: #EF6155FF; + background: #2F1E2E27; } #window.mainbox.listview.element.normal.active { - foreground: #FF815BA4; - background: #272F1E2E; + foreground: #815BA4FF; + background: #2F1E2E27; } #window.mainbox.listview.element.selected.normal { foreground: #FFFFFFFF; - background: #54815BA4; + background: #815BA454; } #window.mainbox.listview.element.selected.urgent { - foreground: #FFEF6155; - background: #54815BA4; + foreground: #EF6155FF; + background: #815BA454; } #window.mainbox.listview.element.selected.active { - foreground: #FF815BA4; - background: #54815BA4; + foreground: #815BA4FF; + background: #815BA454; } #window.mainbox.listview.element.alternate.normal { - foreground: #FFB4B4B4; - background: #A02F1E2E; + foreground: #B4B4B4FF; + background: #2F1E2EA0; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFEF6155; - background: #2F2F1E2E; + foreground: #EF6155FF; + background: #2F1E2E2F; } #window.mainbox.listview.element.alternate.active { - foreground: #FF815BA4; - background: #2F2F1E2E; + foreground: #815BA4FF; + background: #2F1E2E2F; } #window.mainbox.listview.scrollbar { border: 0; @@ -84,6 +84,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FFB4B4B4; - background: #A02F1E2E; + foreground: #B4B4B4FF; + background: #2F1E2EA0; } diff --git a/themes/sidebar.rasi b/themes/sidebar.rasi index b2bdacaa..5287ffd8 100644 --- a/themes/sidebar.rasi +++ b/themes/sidebar.rasi @@ -49,7 +49,7 @@ #window box { border: 0px 2px 0px 0px; foreground: @lightwhite; - background: #ee1c1c1c; + background: #1c1c1cee; } #window mainbox sidebar box { diff --git a/themes/solarized.rasi b/themes/solarized.rasi index 882b4e8a..4624bcf5 100644 --- a/themes/solarized.rasi +++ b/themes/solarized.rasi @@ -9,9 +9,9 @@ } #window { border: 2; - foreground: #FF003642; + foreground: #003642FF; padding: 5; - background: #FF002B37; + background: #002B37FF; } #window.mainbox { border: 0; @@ -22,8 +22,8 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FF819396; - background: #FF002B37; + foreground: #819396FF; + background: #002B37FF; } #window.mainbox.listview { fixed-height: 1; @@ -35,40 +35,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FF819396; - background: #FF002B37; + foreground: #819396FF; + background: #002B37FF; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFDA4281; - background: #FF002B37; + foreground: #DA4281FF; + background: #002B37FF; } #window.mainbox.listview.element.normal.active { - foreground: #FF008ED4; - background: #FF002B37; + foreground: #008ED4FF; + background: #002B37FF; } #window.mainbox.listview.element.selected.normal { - foreground: #FF819396; - background: #FF003642; + foreground: #819396FF; + background: #003642FF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FFDA4281; - background: #FF003642; + foreground: #DA4281FF; + background: #003642FF; } #window.mainbox.listview.element.selected.active { - foreground: #FF008ED4; - background: #FF003642; + foreground: #008ED4FF; + background: #003642FF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FF819396; - background: #FF002B37; + foreground: #819396FF; + background: #002B37FF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFDA4281; - background: #FF002B37; + foreground: #DA4281FF; + background: #002B37FF; } #window.mainbox.listview.element.alternate.active { - foreground: #FF008ED4; - background: #FF002B37; + foreground: #008ED4FF; + background: #002B37FF; } #window.mainbox.listview.scrollbar { border: 0; @@ -83,6 +83,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FF819396; - background: #FF002B37; + foreground: #819396FF; + background: #002B37FF; } diff --git a/themes/solarized_alternate.rasi b/themes/solarized_alternate.rasi index d3ed35a7..86af4a7a 100644 --- a/themes/solarized_alternate.rasi +++ b/themes/solarized_alternate.rasi @@ -9,9 +9,9 @@ } #window { border: 2; - foreground: #FF003642; + foreground: #003642FF; padding: 5; - background: #FF002B37; + background: #002B37FF; } #window.mainbox { border: 0; @@ -22,8 +22,8 @@ padding: 2px 0px 0px ; } #window.mainbox.message.normal { - foreground: #FF819396; - background: #FF002B37; + foreground: #819396FF; + background: #002B37FF; } #window.mainbox.listview { fixed-height: 1; @@ -35,40 +35,40 @@ border: 0; } #window.mainbox.listview.element.normal.normal { - foreground: #FF819396; - background: #FF002B37; + foreground: #819396FF; + background: #002B37FF; } #window.mainbox.listview.element.normal.urgent { - foreground: #FFDA4281; - background: #FF002B37; + foreground: #DA4281FF; + background: #002B37FF; } #window.mainbox.listview.element.normal.active { - foreground: #FF008ED4; - background: #FF002B37; + foreground: #008ED4FF; + background: #002B37FF; } #window.mainbox.listview.element.selected.normal { foreground: #FFFFFFFF; - background: #FF008ED4; + background: #008ED4FF; } #window.mainbox.listview.element.selected.urgent { - foreground: #FF890661; - background: #FF008ED4; + foreground: #890661FF; + background: #008ED4FF; } #window.mainbox.listview.element.selected.active { - foreground: #FF66C6FF; - background: #FF008ED4; + foreground: #66C6FFFF; + background: #008ED4FF; } #window.mainbox.listview.element.alternate.normal { - foreground: #FF819396; - background: #FF003643; + foreground: #819396FF; + background: #003643FF; } #window.mainbox.listview.element.alternate.urgent { - foreground: #FFDA4281; - background: #FF003643; + foreground: #DA4281FF; + background: #003643FF; } #window.mainbox.listview.element.alternate.active { - foreground: #FF008ED4; - background: #FF003643; + foreground: #008ED4FF; + background: #003643FF; } #window.mainbox.listview.scrollbar { border: 0; @@ -83,6 +83,6 @@ #window.mainbox.inputbar.box { } #window.mainbox.inputbar.normal { - foreground: #FF819396; - background: #FF002B37; + foreground: #819396FF; + background: #002B37FF; }