Gtk.CssProvider
const Gtk = imports.gi.Gtk; let css_provider = new Gtk.CssProvider();
GtkCssProvider is an object implementing the Gtk.StyleProvider interface. It is able to parse <ulink url="http://www.w3.org/TR/CSS2">CSS</ulink>-like input in order to style widgets.
<refsect2 id="gtkcssprovider-files"> <title>Default files</title> <para> An application can cause GTK+ to parse a specific CSS style sheet by calling Gtk.load_from_file and adding the provider with Gtk.add_provider or Gtk.add_provider_for_screen. In addition, certain files will be read when GTK+ is initialized. First, the file <filename><envar>$XDG_CONFIG_HOME</envar>/gtk-3.0/gtk.css</filename> is loaded if it exists. Then, GTK+ tries to load <filename><envar>$HOME</envar>/.themes/<replaceable>theme-name</replaceable>/gtk-3.0/gtk.css</filename>, falling back to <filename><replaceable>datadir</replaceable>/share/themes/<replaceable>theme-name</replaceable>/gtk-3.0/gtk.css</filename>, where <replaceable>theme-name</replaceable> is the name of the current theme (see the Gtk.gtk-theme-name setting) and <replaceable>datadir</replaceable> is the prefix configured when GTK+ was compiled, unless overridden by the <envar>GTK_DATA_PREFIX</envar> environment variable. </para> </refsect2> <refsect2 id="gtkcssprovider-stylesheets"> <title>Style sheets</title> <para> The basic structure of the style sheets understood by this provider is a series of statements, which are either rule sets or '@-rules', separated by whitespace. </para> <para> A rule set consists of a selector and a declaration block, which is a series of declarations enclosed in curly braces ({ and }). The declarations are separated by semicolons (;). Multiple selectors can share the same declaration block, by putting all the separators in front of the block, separated by commas. </para> <example><title>A rule set with two selectors</title> <programlisting language="text"> GtkButton, GtkEntry { color: #ff00ea; font: Comic Sans 12 } </programlisting> </example> </refsect2> <refsect2 id="gtkcssprovider-selectors"> <title>Selectors</title> <para> Selectors work very similar to the way they do in CSS, with widget class names taking the role of element names, and widget names taking the role of IDs. When used in a selector, widget names must be prefixed with a '#' character. The '*' character represents the so-called universal selector, which matches any widget. </para> <para> To express more complicated situations, selectors can be combined in various ways: <itemizedlist> <listitem><para>To require that a widget satisfies several conditions, combine several selectors into one by concatenating them. E.g. <literal>GtkButton#button1</literal> matches a GtkButton widget with the name button1.</para></listitem> <listitem><para>To only match a widget when it occurs inside some other widget, write the two selectors after each other, separated by whitespace. E.g. <literal>GtkToolBar GtkButton</literal> matches GtkButton widgets that occur inside a GtkToolBar.</para></listitem> <listitem><para>In the previous example, the GtkButton is matched even if it occurs deeply nested inside the toolbar. To restrict the match to direct children of the parent widget, insert a '>' character between the two selectors. E.g. <literal>GtkNotebook > GtkLabel</literal> matches GtkLabel widgets that are direct children of a GtkNotebook.</para></listitem> </itemizedlist> </para> <example> <title>Widget classes and names in selectors</title> <programlisting language="text"> /* Theme labels that are descendants of a window */ GtkWindow GtkLabel { background-color: #898989 }
/* Theme notebooks, and anything that's within these */ GtkNotebook { background-color: #a939f0 }
/* Theme combo boxes, and entries that are direct children of a notebook */ GtkComboBox, GtkNotebook > GtkEntry { color: @fg_color; background-color: #1209a2 }
/* Theme any widget within a GtkBin */ GtkBin * { font: Sans 20 }
/* Theme a label named title-label */ GtkLabel#title-label { font: Sans 15 }
/* Theme any widget named main-entry */ #main-entry { background-color: #f0a810 } </programlisting> </example> <para> Widgets may also define style classes, which can be used for matching. When used in a selector, style classes must be prefixed with a '.' character. </para> <para> Refer to the documentation of individual widgets to learn which style classes they define and see <xref linkend="gtkstylecontext-classes"/> for a list of all style classes used by GTK+ widgets. </para> <para> Note that there is some ambiguity in the selector syntax when it comes to differentiation widget class names from regions. GTK+ currently treats a string as a widget class name if it contains any uppercase characters (which should work for more widgets with names like GtkLabel). </para> <example> <title>Style classes in selectors</title> <programlisting language="text"> /* Theme all widgets defining the class entry */ .entry { color: #39f1f9; }
/* Theme spinbuttons' entry */ GtkSpinButton.entry { color: #900185 } </programlisting> </example> <para> In complicated widgets like e.g. a GtkNotebook, it may be desirable to style different parts of the widget differently. To make this possible, container widgets may define regions, whose names may be used for matching in selectors. </para> <para> Some containers allow to further differentiate between regions by applying so-called pseudo-classes to the region. For example, the tab region in GtkNotebook allows to single out the first or last tab by using the :first-child or :last-child pseudo-class. When used in selectors, pseudo-classes must be prefixed with a ':' character. </para> <para> Refer to the documentation of individual widgets to learn which regions and pseudo-classes they define and see <xref linkend="gtkstylecontext-classes"/> for a list of all regions used by GTK+ widgets. </para> <example> <title>Regions in selectors</title> <programlisting language="text"> /* Theme any label within a notebook */ GtkNotebook GtkLabel { color: #f90192; }
/* Theme labels within notebook tabs */ GtkNotebook tab GtkLabel { color: #703910; }
/* Theme labels in the any first notebook tab, both selectors are equivalent */ GtkNotebook tab:nth-child(first) GtkLabel, GtkNotebook tab:first-child GtkLabel { color: #89d012; } </programlisting> </example> <para> Another use of pseudo-classes is to match widgets depending on their state. This is conceptually similar to the :hover, :active or :focus pseudo-classes in CSS. The available pseudo-classes for widget states are :active, :prelight (or :hover), :insensitive, :selected, :focused and :inconsistent. </para> <example> <title>Styling specific widget states</title> <programlisting language="text"> /* Theme active (pressed) buttons */ GtkButton:active { background-color: #0274d9; }
/* Theme buttons with the mouse pointer on it, both are equivalent */ GtkButton:hover, GtkButton:prelight { background-color: #3085a9; }
/* Theme insensitive widgets, both are equivalent */ :insensitive, *:insensitive { background-color: #320a91; }
/* Theme selection colors in entries */ GtkEntry:selected { background-color: #56f9a0; }
/* Theme focused labels */ GtkLabel:focused { background-color: #b4940f; }
/* Theme inconsistent checkbuttons */ GtkCheckButton:inconsistent { background-color: #20395a; } </programlisting> </example> <para> Widget state pseudoclasses may only apply to the last element in a selector. </para> <para> To determine the effective style for a widget, all the matching rule sets are merged. As in CSS, rules apply by specificity, so the rules whose selectors more closely match a widget path will take precedence over the others. </para> </refsect2> <refsect2 id="gtkcssprovider-rules"> <title>@ Rules</title> <para> GTK+'s CSS supports the @import rule, in order to load another CSS style sheet in addition to the currently parsed one. </para> <example> <title>Using the @import rule</title> <programlisting language="text"> @import url ("path/to/common.css"); </programlisting> </example> <para id="css-binding-set"> In order to extend key bindings affecting different widgets, GTK+ supports the @binding-set rule to parse a set of bind/unbind directives, see Gtk.BindingSet for the supported syntax. Note that the binding sets defined in this way must be associated with rule sets by setting the gtk-key-bindings style property. </para> <para> Customized key bindings are typically defined in a separate <filename>gtk-keys.css</filename> CSS file and GTK+ loads this file according to the current key theme, which is defined by the Gtk.gtk-key-theme-name setting. </para> <example> <title>Using the @binding rule</title> <programlisting language="text"> @binding-set binding-set1 { bind "<alt>Left" { "move-cursor" (visual-positions, -3, 0) }; unbind "End"; };
@binding-set binding-set2 { bind "<alt>Right" { "move-cursor" (visual-positions, 3, 0) }; bind "<alt>KP_space" { "delete-from-cursor" (whitespace, 1) "insert-at-cursor" (" ") }; };
GtkEntry { gtk-key-bindings: binding-set1, binding-set2; } </programlisting> </example> <para> GTK+ also supports an additional @define-color rule, in order to define a color name which may be used instead of color numeric representations. Also see the Gtk.gtk-color-scheme setting for a way to override the values of these named colors. </para> <example> <title>Defining colors</title> <programlisting language="text"> @define-color bg_color #f9a039;
* { background-color: @bg_color; } </programlisting> </example> </refsect2> <refsect2 id="gtkcssprovider-symbolic-colors"> <title>Symbolic colors</title> <para> Besides being able to define color names, the CSS parser is also able to read different color expressions, which can also be nested, providing a rich language to define colors which are derived from a set of base colors. </para> <example> <title>Using symbolic colors</title> <programlisting language="text"> @define-color entry-color shade (@bg_color, 0.7);
GtkEntry { background-color: @entry-color; }
GtkEntry:focused { background-color: mix (@entry-color, shade (#fff, 0.5), 0.8); } </programlisting> </example> <para> The various ways to express colors in GTK+ CSS are: </para> <informaltable> <tgroup cols="3"> <thead> <row> <entry>Syntax</entry> <entry>Explanation</entry> <entry>Examples</entry> </row> </thead> <tbody> <row> <entry>rgb(@r, @g, @b)</entry> <entry>An opaque color; @r, @g, @b can be either integers between 0 and 255 or percentages</entry> <entry><literallayout>rgb(128, 10, 54) rgb(20%, 30%, 0%)</literallayout></entry> </row> <row> <entry>rgba(@r, @g, @b, @a)</entry> <entry>A translucent color; @r, @g, @b are as in the previous row, @a is a floating point number between 0 and 1</entry> <entry><literallayout>rgba(255, 255, 0, 0.5)</literallayout></entry> </row> <row> <entry>#@xxyyzz</entry> <entry>An opaque color; @xx, @yy, @zz are hexadecimal numbers specifying @r, @g, @b variants with between 1 and 4 hexadecimal digits per component are allowed</entry> <entry><literallayout>#ff12ab #f0c</literallayout></entry> </row> <row> <entry>@name</entry> <entry>Reference to a color that has been defined with @define-color </entry> <entry>@bg_color</entry> </row> <row> <entry>mix(@color1, @color2, @f)</entry> <entry>A linear combination of @color1 and @color2. @f is a floating point number between 0 and 1.</entry> <entry><literallayout>mix(#ff1e0a, @bg_color, 0.8)</literallayout></entry> </row> <row> <entry>shade(@color, @f)</entry> <entry>A lighter or darker variant of @color. @f is a floating point number. </entry> <entry>shade(@fg_color, 0.5)</entry> </row> <row> <entry>lighter(@color)</entry> <entry>A lighter variant of @color</entry> </row> <row> <entry>darker(@color)</entry> <entry>A darker variant of @color</entry> </row> <row> <entry>alpha(@color, @f)</entry> <entry>Modifies passed color's alpha by a factor @f. @f is a floating point number. @f < 1.0 results in a more transparent color while @f > 1.0 results in a more opaque color. </entry> <entry>alhpa(blue, 0.5)</entry> </row> </tbody> </tgroup> </informaltable> </refsect2> <refsect2 id="gtkcssprovider-gradients"> <title>Gradients</title> <para> Linear or radial Gradients can be used as background images. </para> <para> A linear gradient along the line from (@start_x, @start_y) to (@end_x, @end_y) is specified using the syntax <literallayout>-gtk-gradient (linear, @start_x @start_y, @end_x @end_y, color-stop (@position, @color), ...)</literallayout> where @start_x and @end_x can be either a floating point number between 0 and 1 or one of the special values 'left', 'right' or 'center', @start_y and @end_y can be either a floating point number between 0 and 1 or one of the special values 'top', 'bottom' or 'center', @position is a floating point number between 0 and 1 and @color is a color expression (see above). The color-stop can be repeated multiple times to add more than one color stop. 'from (@color)' and 'to (@color)' can be used as abbreviations for color stops with position 0 and 1, respectively. </para> <example> <title>A linear gradient</title> <inlinegraphic fileref="gradient1.png" format="PNG"/> <para>This gradient was specified with <literallayout>-gtk-gradient (linear, left top, right bottom, from(@yellow), to(@blue))</literallayout></para> </example> <example> <title>Another linear gradient</title> <inlinegraphic fileref="gradient2.png" format="PNG"/> <para>This gradient was specified with <literallayout>-gtk-gradient (linear, 0 0, 0 1, color-stop(0, @yellow), color-stop(0.2, @blue), color-stop(1, #0f0))</literallayout></para> </example> <para> A radial gradient along the two circles defined by (@start_x, @start_y, @start_radius) and (@end_x, @end_y, @end_radius) is specified using the syntax <literallayout>-gtk-gradient (radial, @start_x @start_y, @start_radius, @end_x @end_y, @end_radius, color-stop (@position, @color), ...)</literallayout> where @start_radius and @end_radius are floating point numbers and the other parameters are as before. </para> <example> <title>A radial gradient</title> <inlinegraphic fileref="gradient3.png" format="PNG"/> <para>This gradient was specified with <literallayout>-gtk-gradient (radial, center center, 0, center center, 1, from(@yellow), to(@green))</literallayout></para> </example> <example> <title>Another radial gradient</title> <inlinegraphic fileref="gradient4.png" format="PNG"/> <para>This gradient was specified with <literallayout>-gtk-gradient (radial, 0.4 0.4, 0.1, 0.6 0.6, 0.7, color-stop (0, #f00), color-stop (0.1, #a0f), color-stop (0.2, @yellow), color-stop (1, @green))</literallayout></para> </example> </refsect2> <refsect2 id="gtkcssprovider-shadows"> <title>Text shadow</title> <para> A shadow list can be applied to text or symbolic icons, using the CSS3 text-shadow syntax, as defined in <ulink url="http://www.w3.org/TR/css3-text/#text-shadow">the CSS3 specification</ulink>. </para> <para> A text shadow is specified using the syntax <literallayout>text-shadow: @horizontal_offset @vertical_offset [ @blur_radius ] @color</literallayout> The offset of the shadow is specified with the @horizontal_offset and @vertical_offset parameters. The optional blur radius is parsed, but it is currently not rendered by the GTK+ theming engine. </para> <para> To set a shadow on an icon, use the icon-shadow property instead, with the same syntax. </para> <para> To set multiple shadows on an element, you can specify a comma-separated list of shadow elements in the text-shadow or icon-shadow property. Shadows are always rendered front-back, i.e. the first shadow specified is on top of the others. Shadows can thus overlay each other, but they can never overlay the text or icon itself, which is always rendered on top of the shadow layer. </para> </refsect2> <refsect2> <title>Box shadow</title> <para> Themes can apply shadows on framed elements using the CSS3 box-shadow syntax, as defined in <ulink url="http://www.w3.org/TR/css3-background/#the-box-shadow">the CSS3 specification</ulink>. </para> <para> A box shadow is specified using the syntax <literallayout>box-shadow: [ @inset ] @horizontal_offset @vertical_offset [ @blur_radius ] [ @spread ] @color</literallayout> A positive offset will draw a shadow that is offset to the right (down) of the box, a negative offset to the left (top). The optional spread parameter defines an additional distance to expand the shadow shape in all directions, by the specified radius. The optional blur radius parameter is parsed, but it is currently not rendered by the GTK+ theming engine. The inset parameter defines whether the drop shadow should be rendered inside or outside the box canvas. Only inset box-shadows are currently supported by the GTK+ theming engine, non-inset elements are currently ignored. </para> <para> To set multiple box-shadows on an element, you can specify a comma-separated list of shadow elements in the box-shadow property. Shadows are always rendered front-back, i.e. the first shadow specified is on top of the others, so they may overlap other boxes or other shadows. </para> </refsect2> <refsect2 id="gtkcssprovider-border-image"> <title>Border images</title> <para> Images and gradients can also be used in slices for the purpose of creating scalable borders. For more information, see the CSS3 documentation for the border-image property, which can be found <ulink url="http://www.w3.org/TR/css3-background/#border-images">here</ulink>. </para> <inlinegraphic fileref="slices.png" format="PNG"/> <para> The parameters of the slicing process are controlled by four separate properties. Note that you can use the <literallayout>border-image</literallayout> shorthand property to set values for the three properties at the same time. </para> <para> <literallayout>border-image-source: url(@path) (or border-image-source: -gtk-gradient(...))</literallayout>: Specifies the source of the border image, and it can either be an URL or a gradient (see above). </para> <para> <literallayout>border-image-slice: @top @right @bottom @left</literallayout> The sizes specified by the @top, @right, @bottom and @left parameters are the offsets, in pixels, from the relevant edge where the image should be "cut off" to build the slices used for the rendering of the border. </para> <para> <literallayout>border-image-width: @top @right @bottom @left</literallayout> The sizes specified by the @top, @right, @bottom and @left parameters are inward distances from the border box edge, used to specify the rendered size of each slice determined by border-image-slice. If this property is not specified, the values of border-width will be used as a fallback. </para> <para> <literallayout>border-image-repeat: [stretch|repeat|round|space] ? [stretch|repeat|round|space]</literallayout> Specifies how the image slices should be rendered in the area outlined by border-width. The default (stretch) is to resize the slice to fill in the whole allocated area. If the value of this property is 'repeat', the image slice will be tiled to fill the area. If the value of this property is 'round', the image slice will be tiled to fill the area, and scaled to fit it exactly a whole number of times. If the value of this property is 'space', the image slice will be tiled to fill the area, and if it doesn't fit it exactly a whole number of times, the extra space is distributed as padding around the slices. If two options are specified, the first one affects the horizontal behaviour and the second one the vertical behaviour. If only one option is specified, it affects both. </para> <example> <title>A border image</title> <inlinegraphic fileref="border1.png" format="PNG"/> <para>This border image was specified with <literallayout>url("gradient1.png") 10 10 10 10</literallayout> </para> </example> <example> <title>A repeating border image</title> <inlinegraphic fileref="border2.png" format="PNG"/> <para>This border image was specified with <literallayout>url("gradient1.png") 10 10 10 10 repeat</literallayout> </para> </example> <example> <title>A stretched border image</title> <inlinegraphic fileref="border3.png" format="PNG"/> <para>This border image was specified with <literallayout>url("gradient1.png") 10 10 10 10 stretch</literallayout> </para> </example> </refsect2> <refsect2 id="gtkcssprovider-transitions"> <para>Styles can specify transitions that will be used to create a gradual change in the appearance when a widget state changes. The following syntax is used to specify transitions: <literallayout>@duration [s|ms] [linear|ease|ease-in|ease-out|ease-in-out] [loop]?</literallayout> The @duration is the amount of time that the animation will take for a complete cycle from start to end. If the loop option is given, the animation will be repated until the state changes again. The option after the duration determines the transition function from a small set of predefined functions. <figure><title>Linear transition</title> <graphic fileref="linear.png" format="PNG"/> </figure> <figure><title>Ease transition</title> <graphic fileref="ease.png" format="PNG"/> </figure> <figure><title>Ease-in-out transition</title> <graphic fileref="ease-in-out.png" format="PNG"/> </figure> <figure><title>Ease-in transition</title> <graphic fileref="ease-in.png" format="PNG"/> </figure> <figure><title>Ease-out transition</title> <graphic fileref="ease-out.png" format="PNG"/> </figure> </para> </refsect2> <refsect2 id="gtkcssprovider-properties"> <title>Supported properties</title> <para> Properties are the part that differ the most to common CSS, not all properties are supported (some are planned to be supported eventually, some others are meaningless or don't map intuitively in a widget based environment). </para> <para> The currently supported properties are: </para> <informaltable> <tgroup cols="4"> <thead> <row> <entry>Property name</entry> <entry>Syntax</entry> <entry>Maps to</entry> <entry>Examples</entry> </row> </thead> <tbody> <row> <entry>engine</entry> <entry>engine-name</entry> <entry>Gtk.ThemingEngine</entry> <entry>engine: clearlooks; engine: none; /* use the default (i.e. builtin) engine) */ </entry> </row> <row> <entry>background-color</entry> <entry morerows="2">color (see above)</entry> <entry morerows="7">Gdk.RGBA</entry> <entry morerows="7"><literallayout>background-color: #fff; color: &color1; background-color: shade (&color1, 0.5); color: mix (&color1, #f0f, 0.8);</literallayout> </entry> </row> <row> <entry>color</entry> </row> <row> <entry>border-top-color</entry> <entry morerows="4">transparent|color (see above)</entry> </row> <row> <entry>border-right-color</entry> </row> <row> <entry>border-bottom-color</entry> </row> <row> <entry>border-left-color</entry> </row> <row> <entry>border-color</entry> <entry>[transparent|color]{1,4}</entry> </row> <row> <entry>font-family</entry> <entry>@family [, @family]*</entry> <entry>#gchararray</entry> <entry>font-family: Sans, Arial;</entry> </row> <row> <entry>font-style</entry> <entry>[normal|oblique|italic]</entry> <entry>#PANGO_TYPE_STYLE</entry> <entry>font-style: italic;</entry> </row> <row> <entry>font-variant</entry> <entry>[normal|small-caps]</entry> <entry>#PANGO_TYPE_VARIANT</entry> <entry>font-variant: normal;</entry> </row> <row> <entry>font-weight</entry> <entry>[normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900]</entry> <entry>#PANGO_TYPE_WEIGHT</entry> <entry>font-weight: bold;</entry> </row> <row> <entry>font-size</entry> <entry>Font size in point</entry> <entry>#gint</entry> <entry>font-size: 13;</entry> </row> <row> <entry>font</entry> <entry>@family [@style] [@size]</entry> <entry>Pango.FontDescription</entry> <entry>font: Sans 15;</entry> </row> <row> <entry>margin-top</entry> <entry>integer</entry> <entry>#gint</entry> <entry>margin-top: 0;</entry> </row> <row> <entry>margin-left</entry> <entry>integer</entry> <entry>#gint</entry> <entry>margin-left: 1;</entry> </row> <row> <entry>margin-bottom</entry> <entry>integer</entry> <entry>#gint</entry> <entry>margin-bottom: 2;</entry> </row> <row> <entry>margin-right</entry> <entry>integer</entry> <entry>#gint</entry> <entry>margin-right: 4;</entry> </row> <row> <entry>margin</entry> <entry morerows="1"><literallayout>@width @vertical_width @horizontal_width @top_width @horizontal_width @bottom_width @top_width @right_width @bottom_width @left_width</literallayout> </entry> <entry morerows="1">Gtk.Border</entry> <entry morerows="1"><literallayout>margin: 5; margin: 5 10; margin: 5 10 3; margin: 5 10 3 5;</literallayout> </entry> </row> <row> <entry>padding-top</entry> <entry>integer</entry> <entry>#gint</entry> <entry>padding-top: 5;</entry> </row> <row> <entry>padding-left</entry> <entry>integer</entry> <entry>#gint</entry> <entry>padding-left: 5;</entry> </row> <row> <entry>padding-bottom</entry> <entry>integer</entry> <entry>#gint</entry> <entry>padding-bottom: 5;</entry> </row> <row> <entry>padding-right</entry> <entry>integer</entry> <entry>#gint</entry> <entry>padding-right: 5;</entry> </row> <row> <entry>padding</entry> </row> <row> <entry>background-image</entry> <entry><literallayout>gradient (see above) or url(@path)</literallayout></entry> <entry>#cairo_pattern_t</entry> <entry><literallayout>-gtk-gradient (linear, left top, right top, from (#fff), to (#000)); -gtk-gradient (linear, 0.0 0.5, 0.5 1.0, from (#fff), color-stop (0.5, #f00), to (#000)); -gtk-gradient (radial, center center, 0.2, center center, 0.8, color-stop (0.0, #fff), color-stop (1.0, #000)); url ('background.png');</literallayout> </entry> </row> <row> <entry>background-repeat</entry> <entry>[repeat|no-repeat]</entry> <entry>internal</entry> <entry><literallayout>background-repeat: no-repeat;</literallayout> If not specified, the style doesn't respect the CSS3 specification, since the background will be stretched to fill the area. </entry> </row> <row> <entry>border-top-width</entry> <entry>integer</entry> <entry>#gint</entry> <entry>border-top-width: 5;</entry> </row> <row> <entry>border-left-width</entry> <entry>integer</entry> <entry>#gint</entry> <entry>border-left-width: 5;</entry> </row> <row> <entry>border-bottom-width</entry> <entry>integer</entry> <entry>#gint</entry> <entry>border-bottom-width: 5;</entry> </row> <row> <entry>border-right-width</entry> <entry>integer</entry> <entry>#gint</entry> <entry>border-right-width: 5;</entry> </row> <row> <entry>border-width</entry> <entry morerows="1">Gtk.Border</entry> <entry morerows="1"><literallayout>border-width: 1; border-width: 1 2; border-width: 1 2 3; border-width: 1 2 3 5;</literallayout> </entry> </row> <row> <entry>border-radius</entry> <entry>integer</entry> <entry>#gint</entry> <entry>border-radius: 5;</entry> </row> <row> <entry>border-style</entry> <entry>[none|solid|inset|outset]</entry> <entry>Gtk.BorderStyle</entry> <entry>border-style: solid;</entry> </row> <row> <entry>border-image</entry> <entry><literallayout>border image (see above)</literallayout></entry> <entry>internal use only</entry> <entry><literallayout>border-image: url("/path/to/image.png") 3 4 3 4 stretch; border-image: url("/path/to/image.png") 3 4 4 3 repeat stretch;</literallayout> </entry> </row> <row> <entry>text-shadow</entry> <entry>shadow list (see above)</entry> <entry>internal use only</entry> <entry><literallayout>text-shadow: 1 1 0 blue, -4 -4 red;</literallayout></entry> </row> <row> <entry>transition</entry> <entry>transition (see above)</entry> <entry>internal use only</entry> <entry><literallayout>transition: 150ms ease-in-out; transition: 1s linear loop;</literallayout> </entry> </row> <row> <entry>gtk-key-bindings</entry> <entry>binding set name list</entry> <entry>internal use only</entry> <entry><literallayout>gtk-bindings: binding1, binding2, ...;</literallayout> </entry> </row> </tbody> </tgroup> </informaltable> <para> GtkThemingEngines can register their own, engine-specific style properties with the function Gtk.register_property. These properties can be set in CSS like other properties, using a name of the form <literallayout>-<replaceable>namespace</replaceable>-<replaceable>name</replaceable></literallayout>, where <replaceable>namespace</replaceable> is typically the name of the theming engine, and <replaceable>name</replaceable> is the name of the property. Style properties that have been registered by widgets using Gtk.install_style_property can also be set in this way, using the widget class name for <replaceable>namespace</replaceable>. </para> <example> <title>Using engine-specific style properties</title> <programlisting> * { engine: clearlooks; border-radius: 4; -GtkPaned-handle-size: 6; -clearlooks-colorize-scrollbar: false; } </programlisting> </example> </refsect2>
Hierarchy
-
GObject.Object
- Gtk.CssProvider