forked from davatorium/rofi-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rofi_gtk_colors.py
executable file
·45 lines (28 loc) · 1.7 KB
/
rofi_gtk_colors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /usr/bin/env python3
##
# GPL license
# Code based on MATE-HUD.
# URL: https://bitbucket.org/ubuntu-mate/mate-hud/
# Modifications made by Dave Davenport <[email protected]>
##
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gio, GLib, Gtk
def rgba_to_hex(color):
return "#{0:02x}{1:02x}{2:02x}".format( int(color.red * 255), int(color.green * 255), int(color.blue * 255))
window = Gtk.Window()
style_context = window.get_style_context()
bg_color = rgba_to_hex(style_context.lookup_color('theme_bg_color')[1])
fg_color = rgba_to_hex(style_context.lookup_color('theme_fg_color')[1])
selected_bg_color = rgba_to_hex(style_context.lookup_color('theme_selected_bg_color')[1])
selected_fg_color = rgba_to_hex(style_context.lookup_color('theme_selected_fg_color')[1])
error_bg_color = rgba_to_hex(style_context.lookup_color('error_bg_color')[1])
error_fg_color = rgba_to_hex(style_context.lookup_color('error_fg_color')[1])
warning_bg_color = rgba_to_hex(style_context.lookup_color('warning_bg_color')[1])
warning_fg_color = rgba_to_hex(style_context.lookup_color('warning_fg_color')[1])
text_color = rgba_to_hex(style_context.lookup_color('theme_text_color')[1])
borders = rgba_to_hex(style_context.lookup_color('theme_unfocused_fg_color')[1])
print( 'rofi.color-window: '+ bg_color +", " + borders + ", " + borders)
print( 'rofi.color-normal: '+ bg_color +", " + fg_color + ", " + bg_color + ", " + selected_bg_color + ", " + selected_fg_color)
print( 'rofi.color-active: '+ bg_color +", " + fg_color + ", " + bg_color + ", " + warning_bg_color + ", " + warning_fg_color)
print( 'rofi.color-urgent: '+ bg_color +", " + fg_color + ", " + bg_color + ", " + error_bg_color + ", " + error_fg_color)