summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-05-16 21:55:52 +0200
committerDave Davenport <qball@gmpclient.org>2017-05-16 21:55:52 +0200
commit30fb8c514ed6eaf223ab6c79929a5745d7280b99 (patch)
treec530c4aa8786f46a7b7c8db16ba71fb5c06013b4 /source
parent494550d38d572801ba3924611b09c7ca2b20610a (diff)
Change ARGB to RGBA, fix in theme converter
Diffstat (limited to 'source')
-rw-r--r--source/rofi.c19
-rw-r--r--source/theme.c42
2 files changed, 37 insertions, 24 deletions
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 985d62c2..03f3e859 100644
--- a/source/theme.c
+++ b/source/theme.c
@@ -173,11 +173,11 @@ static void rofi_theme_print_property_index ( size_t pnl, int depth, Property *p
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;
@@ -197,11 +197,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 ) &&
@@ -635,6 +635,20 @@ 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 ) {
@@ -645,7 +659,7 @@ void rofi_theme_convert_old ( void )
"* { 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 );
}
@@ -661,7 +675,7 @@ 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 );
}
@@ -677,7 +691,7 @@ 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 );
}
@@ -693,7 +707,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 );
}