GtkSourceStyle: libgedit-gtksourceview 300 Reference Manual

## GtkSourceStyle GtkSourceStyle — A style |

## Functions

GtkSourceStyle * | gtk_source_style_new ()
GtkSourceStyle * | gtk_source_style_ref ()
void | gtk_source_style_unref ()
void | gtk_source_style_apply ()

## Types and Values

struct | GtkSourceStyle

## Object Hierarchy

        GBoxed
        ╰── GtkSourceStyle

## Includes

    #include <gtksourceview/gtksource.h>

## Description

The GtkSourceStyle structure contains text attributes.

## Functions

### gtk_source_style_new ()

    GtkSourceStyle *
    gtk_source_style_new (void);

Creates a new GtkSourceStyle with initially all the "`use_`" fields set to `FALSE`.

#### Returns

a new GtkSourceStyle with a reference count of one.

Since: 299.2

### gtk_source_style_ref ()

    GtkSourceStyle *
    gtk_source_style_ref (GtkSourceStyle *style);

Increases the reference count of `style` by one.

#### Parameters

style | a GtkSourceStyle. |

#### Returns

the passed in `style` .

[transfer full]

Since: 299.2

### gtk_source_style_unref ()

    void
    gtk_source_style_unref (GtkSourceStyle *style);

Decreases the reference count of `style` by one. If the reference count drops to 0, `style` is freed.

#### Parameters

style | a GtkSourceStyle. |

Since: 299.2

### gtk_source_style_apply ()

    void
    gtk_source_style_apply (GtkSourceStyle *style,
                            GtkTextTag *tag);

This function modifies the GtkTextTag properties that are related to the GtkSourceStyle attributes. Other GtkTextTag properties are left untouched.

If `style` is non-`NULL`, applies `style` to `tag` .

If `style` is `NULL`, the related `*-set` properties of GtkTextTag are set to `FALSE`.

#### Parameters

style | a GtkSourceStyle to apply, or `NULL`. | [nullable]
tag | a GtkTextTag to apply styles to. |

Since: 3.22

## Types and Values

### struct GtkSourceStyle

    struct GtkSourceStyle {
    	GdkRGBA foreground_color;
    	GdkRGBA background_color;
    	GdkRGBA underline_color;
    	gdouble scale;
    	PangoUnderline underline;
    	guint italic : 1;
    	guint bold : 1;
    	guint strikethrough : 1;

    	guint use_foreground_color : 1;
    	guint use_background_color : 1;
    	guint use_underline_color : 1;
    	guint use_scale : 1;
    	guint use_underline : 1;
    	guint use_italic : 1;
    	guint use_bold : 1;
    	guint use_strikethrough : 1;
    };

Before using the value of a certain field, check the boolean value of the corresponding "`use_`" field.

#### Members

GdkRGBA `foreground_color`; | Equivalent to “foreground-rgba”. |
GdkRGBA `background_color`; | Equivalent to “background-rgba”. |
GdkRGBA `underline_color`; | Equivalent to “underline-rgba”. |
gdouble `scale`; | Equivalent to “scale”. |
PangoUnderline `underline`; | Equivalent to “underline”. |
guint `italic` : 1; | For “style”. |
guint `bold` : 1; | For “weight”. |
guint `strikethrough` : 1; | Equivalent to “strikethrough”. |
guint `use_foreground_color` : 1; | Whether `foreground_color` can be taken into account. |
guint `use_background_color` : 1; | Whether `background_color` can be taken into account. |
guint `use_underline_color` : 1; | Whether `underline_color` can be taken into account. |
guint `use_scale` : 1; | Whether `scale` can be taken into account. |
guint `use_underline` : 1; | Whether `underline` can be taken into account. |
guint `use_italic` : 1; | Whether `italic` can be taken into account. |
guint `use_bold` : 1; | Whether `bold` can be taken into account. |
guint `use_strikethrough` : 1; | Whether `strikethrough` can be taken into account. |

Since: 299.2