move foreground/background color to config file
This commit is contained in:
		
							parent
							
								
									a20849d453
								
							
						
					
					
						commit
						c2d12b7503
					
				
							
								
								
									
										3
									
								
								config.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								config.h
									
									
									
									
									
								
							@ -5,9 +5,6 @@ static const char *url_regex = "(ftp|http)s?://[-a-zA-Z0-9.?$%&/=_~#.,:;+]*";
 | 
				
			|||||||
// 0.0: opaque, 1.0: transparent
 | 
					// 0.0: opaque, 1.0: transparent
 | 
				
			||||||
//#define TRANSPARENCY 0.2
 | 
					//#define TRANSPARENCY 0.2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const char *foreground_color = "#dcdccc";
 | 
					 | 
				
			||||||
static const char *background_color = "#3f3f3f";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static const char *palette_s[16] = {
 | 
					static const char *palette_s[16] = {
 | 
				
			||||||
    "#3f3f3f", // black
 | 
					    "#3f3f3f", // black
 | 
				
			||||||
    "#705050", // red
 | 
					    "#705050", // red
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										21
									
								
								termite.c
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								termite.c
									
									
									
									
									
								
							@ -334,14 +334,27 @@ static void load_config(GtkWindow *window, VteTerminal *vte,
 | 
				
			|||||||
            g_free(icon_name);
 | 
					            g_free(icon_name);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        gdk_color_parse(foreground_color, &colors->foreground);
 | 
					 | 
				
			||||||
        gdk_color_parse(background_color, &colors->background);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        for (unsigned i = 0; i < 16; i++) {
 | 
					        for (unsigned i = 0; i < 16; i++) {
 | 
				
			||||||
            gdk_color_parse(palette_s[i], &colors->palette[i]);
 | 
					            gdk_color_parse(palette_s[i], &colors->palette[i]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        vte_terminal_set_colors(vte, &colors->foreground, &colors->background, colors->palette, 16);
 | 
					        vte_terminal_set_colors(vte, NULL, NULL, colors->palette, 16);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        gchar *foreground_color = g_key_file_get_string(config, "colors", "foreground", &error);
 | 
				
			||||||
 | 
					        IGNORE_ON_ERROR(error) {
 | 
				
			||||||
 | 
					            if (gdk_color_parse(foreground_color, &colors->foreground)) {
 | 
				
			||||||
 | 
					                vte_terminal_set_color_foreground(vte, &colors->foreground);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            g_free(foreground_color);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        gchar *background_color = g_key_file_get_string(config, "colors", "background", &error);
 | 
				
			||||||
 | 
					        IGNORE_ON_ERROR(error) {
 | 
				
			||||||
 | 
					            if (gdk_color_parse(background_color, &colors->background)) {
 | 
				
			||||||
 | 
					                vte_terminal_set_color_background(vte, &colors->background);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            g_free(background_color);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        gchar *cursor_color = g_key_file_get_string(config, "colors", "cursor", &error);
 | 
					        gchar *cursor_color = g_key_file_get_string(config, "colors", "cursor", &error);
 | 
				
			||||||
        IGNORE_ON_ERROR(error) {
 | 
					        IGNORE_ON_ERROR(error) {
 | 
				
			||||||
 | 
				
			|||||||
@ -19,4 +19,6 @@ cursor_blink = SYSTEM
 | 
				
			|||||||
cursor_shape = BLOCK
 | 
					cursor_shape = BLOCK
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[colors]
 | 
					[colors]
 | 
				
			||||||
 | 
					foreground = #dcdccc
 | 
				
			||||||
 | 
					background = #3f3f3f
 | 
				
			||||||
cursor = #dcdccc
 | 
					cursor = #dcdccc
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user