Debian Codegraph @

docs/theme.rst

raw
1 .. _theme:
2
3 Theme
4 =====
5
6 Application style can be configured in the Appearance configuration tab and
7 using Cascading Style Sheets (CSS).
8
9 Appearance Configuration
10 ------------------------
11
12 The Appearance tab in configuration dialog allows to change font and colors of
13 the item list and other GUI elements in the main window.
14
15 By default, only the item list and internal item editor style is changed. To
16 change theme of whole the main window (menu bar, tool bar, tabs) and menus,
17 enable option "Set colors for tabs, tool bar and menus".
18
19 .. note::
20
21 Some desktop environments handle the tray menu style by themselves and it
22 cannot be changed in CopyQ.
23
24 You can change style in more detail by using "Edit Theme" button.
25
26 .. seealso::
27
28 :ref:`faq-hide-menu-bar`
29
30 Style Sheets
31 ------------
32
33 The appearance options are the used in application CSS files installed with
34 CopyQ (e.g. placeholders in the files like ``${font}``). You can list the
35 theme installation path with ``copyq info themes`` command.
36
37 To override a CSS file, copy the file to your configuration directory under
38 ``themes`` subdirectory. For example, override the style sheet for the item
39 list:
40
41 .. code-block:: bash
42
43 $ copyq info themes
44 /usr/share/copyq/themes
45
46 $ copyq info config
47 /home/me/.config/copyq/copyq.conf
48
49 $ cp /usr/share/copyq/themes/items.css /home/me/.config/copyq/themes/
50
51 $ $EDITOR /home/me/.config/copyq/themes/items.css
52
53 To reload the style sheets, you need to restart CopyQ or go to the
54 configuration dialog and click OK button.
55
56 You can set ``COPYQ_THEME_PREFIX`` environment variable for the preferred path
57 for CSS files.
58
59 CSS files can contain placeholders like ``${bg}`` which are defined in theme
60 configuration file. You can edit this file in Appearance configuration tab with
61 "Edit Theme" button.
62
63 Placeholder can be assigned to colors in following formats:
64
65 - ``#RGB`` (each of R, G, and B is a single hex digit)
66 - ``#RRGGBB``
67 - ``#AARRGGBB`` (with alpha channel)
68 - `a color name <https://www.w3.org/TR/SVG11/types.html#ColorKeywords>`__
69 - ``transparent``
70 - ``rgba(R,G,B,A)`` (each of R, G, and B is 0-255, A is alpha channel 0.0-1.0)
71
72 There are extra color names for current system theme:
73
74 - ``default_bg`` - background for list and line/text edit widgets
75 - ``default_text`` - foreground color for the above
76 - ``default_placeholder_text`` - placeholder text color
77 - ``default_alt_bg`` - alternative item background
78 - ``default_highlight_bg`` - highlight background
79 - ``default_highlight_text`` - highlighted text color
80 - ``default_tooltip_bg`` - tooltip background
81 - ``default_tooltip_text`` - tooltip text color
82 - ``default_window`` - window background
83 - ``default_window_text`` - window text color
84 - ``default_button`` - button background
85 - ``default_button_text`` - button text color
86 - ``default_bright_text`` - bright window text color
87 - ``default_light`` - lighter than button
88 - ``default_midlight`` - between button and light
89 - ``default_dark`` - darker than button
90 - ``default_mid`` - between button and dark
91 - ``default_shadow`` - very dark
92 - ``default_link`` - hyperlink color
93 - ``default_link_visited`` - visited hyperlink color
94
95 Placeholder can be also assigned color expressions, for example:
96
97 - ``sel_bg=bg + #000409 - #100``
98 - ``menu_bar_css="background: ${bg}; color: ${fg + #444}"``
99 - ``${bg + #333}`` (directly in CSS)
100
101 Here are some special placeholders for CSS files:
102
103 - ``${css:scrollbar}`` - include ``scrollbar.css`` style sheet.
104 - ``${scale = 0.5}`` - set scaling for sizes and font (reset with value 1)
105 - ``${hsv_saturation_factor = 2}`` - set saturation for colors in the rest of
106 the style sheet
107 - ``${hsv_value_factor = 0.9}`` - set value for colors in the rest of the style
108 sheet
109
110 Plugin Indicators
111 ~~~~~~~~~~~~~~~~~
112
113 Some plugins draw visual indicators on items. The **pinned** plugin draws a
114 vertical border on the right edge, and the **notes** plugin draws a small bar
115 next to the note text.
116
117 Both indicators derive their color from the CSS ``color`` property of the item
118 widget and are rendered semi-transparent by default.
119
120 To set the indicator color or width explicitly, use the ``qproperty-`` CSS
121 properties on the plugin widget class. When a color property is set, it is used
122 exactly as specified with no alpha modification.
123
124 .. note::
125
126 Qt ``qproperty-`` values are applied once when the rule matches and are not
127 reverted when the rule stops matching. To vary a property by state (e.g.
128 selected vs. unselected), you must set explicit values for **both** states.
129
130 **Pinned indicator properties:**
131
132 - ``qproperty-pinnedIndicatorColor`` --- indicator color (default: text color at 20% opacity)
133 - ``qproperty-pinnedIndicatorWidth`` --- border width in points (default: ``6``)
134
135 .. code-block:: css
136
137 /* Solid red pinned indicator, wider border */
138 ItemPinned {
139 qproperty-pinnedIndicatorColor: rgba(255, 0, 0, 255);
140 qproperty-pinnedIndicatorWidth: 10;
141 }
142
143 /* Different indicator color when selected (both rules required) */
144 ItemPinned { qproperty-pinnedIndicatorColor: rgba(0, 0, 255, 128); }
145 ItemPinned[CopyQ_selected="true"] {
146 qproperty-pinnedIndicatorColor: rgba(255, 204, 0, 255);
147 }
148
149 **Notes indicator properties:**
150
151 - ``qproperty-notesIndicatorColor`` --- indicator color (default: text color at 31% opacity)
152 - ``qproperty-notesIndicatorWidth`` --- bar indent/width in pixels (default: ``16``)
153
154 .. code-block:: css
155
156 /* Custom notes indicator color */
157 ItemNotes { qproperty-notesIndicatorColor: rgba(100, 200, 100, 180); }
158
159 /* Wider notes bar */
160 ItemNotes { qproperty-notesIndicatorWidth: 24; }