7 Functions

Procedure: accent-color-to-rgba! self rgba ⇒ rgba

Converts self to a <GdkRGBA> representing its background color.

The matching foreground color is white.

self

Passed: a <AdwAccentColor>, or one of its symbols.

an accent color

rgba

Passed, filled in, and returned: a <GdkRGBA>.

return location for the color

Procedure: accent-color-to-standalone-rgba! self dark rgba ⇒ rgba

Converts self to a <GdkRGBA> representing its standalone color.

It will typically be darker for light background, and lighter for dark background, ensuring contrast.

self

Passed: a <AdwAccentColor>, or one of its symbols.

an accent color

dark

Passed: a boolean.

Whether to calculate standalone color for light or dark background

rgba

Passed, filled in, and returned: a <GdkRGBA>.

return location for the color

Procedure: breakpoint-condition-parse str ⇒ %return

Parses a condition from a string.

Length conditions are specified as <type>: <value>[<unit>], where:

  • <type> can be min-width, max-width, min-height or max-height
  • <value> is a fractional number
  • <unit> can be px, pt or sp

If the unit is omitted, px is assumed.

See BreakpointCondition.new_length.

Examples:

  • min-width: 500px
  • min-height: 400pt
  • max-width: 100sp
  • max-height: 500

Ratio conditions are specified as <type>: <width>[/<height>], where:

  • <type> can be min-aspect-ratio or max-aspect-ratio
  • <width> and <height> are integer numbers

See BreakpointCondition.new_ratio.

The ratio is represented as <width> divided by <height>.

If <height> is omitted, it’s assumed to be 1.

Examples:

  • min-aspect-ratio: 4/3
  • max-aspect-ratio: 1

The logical operators and, or can be used to compose a complex condition as follows:

  • <condition> and <condition>: the condition is true when both <condition>s are true, same as when using BreakpointCondition.new_and
  • <condition> or <condition>: the condition is true when either of the <condition>s is true, same as when using BreakpointCondition.new_or

Examples:

  • min-width: 400px and max-aspect-ratio: 4/3
  • max-width: 360sp or max-width: 360px

Conditions can be further nested using parentheses, for example:

  • min-width: 400px and (max-aspect-ratio: 4/3 or max-height: 400px)

If parentheses are omitted, the first operator takes priority.

str

Passed: a string.

the string specifying the condition

%return

Returned: a <AdwBreakpointCondition>.

the parsed condition

Procedure: easing-ease self value ⇒ %return

Computes easing with easing for value.

value should generally be in the [0, 1] range.

self

Passed: a <AdwEasing>, or one of its symbols.

an easing value

value

Passed: a real number.

a value to ease

%return

Returned: a real number.

the easing for value

Procedure: get-enable-animations? widget ⇒ %return

Checks whether animations are enabled for widget.

This should be used when implementing an animated widget to know whether to animate it or not.

widget

Passed: a <GtkWidget>.

a <GtkWidget>

%return

Returned: a boolean.

whether animations are enabled for widget

Procedure: get-major-version ⇒ %return

Returns the major version number of the Adwaita library.

For example, in libadwaita version 1.2.3 this is 1.

This function is in the library, so it represents the libadwaita library your code is running against. Contrast with the MAJOR_VERSION constant, which represents the major version of the libadwaita headers you have included when compiling your code.

%return

Returned: an unsigned 32-bit integer.

the major version number of the Adwaita library

Procedure: get-micro-version ⇒ %return

Returns the micro version number of the Adwaita library.

For example, in libadwaita version 1.2.3 this is 3.

This function is in the library, so it represents the libadwaita library your code is running against. Contrast with the MAJOR_VERSION constant, which represents the micro version of the libadwaita headers you have included when compiling your code.

%return

Returned: an unsigned 32-bit integer.

the micro version number of the Adwaita library

Procedure: get-minor-version ⇒ %return

Returns the minor version number of the Adwaita library.

For example, in libadwaita version 1.2.3 this is 2.

This function is in the library, so it represents the libadwaita library your code is running against. Contrast with the MAJOR_VERSION constant, which represents the minor version of the libadwaita headers you have included when compiling your code.

%return

Returned: an unsigned 32-bit integer.

the minor version number of the Adwaita library

Procedure: init

Initializes Libadwaita.

This function can be used instead of init as it initializes GTK implicitly.

There’s no need to call this function if you’re using Application.

If Libadwaita has already been initialized, the function will simply return.

This makes sure translations, types, themes, and icons for the Adwaita library are set up properly.

Procedure: is-initialized? ⇒ %return

Use this function to check if libadwaita has been initialized with init.

%return

Returned: a boolean.

the initialization status

Procedure: length-unit-from-px unit value [settings] ⇒ %return

Converts value from pixels to unit.

unit

Passed: a <AdwLengthUnit>, or one of its symbols.

a length unit

value

Passed: a real number.

a value in pixels

settings

Passed, or left out: a <GtkSettings>, or #f.

settings to use, or NULL for default settings

%return

Returned: a real number.

the length in unit

Procedure: length-unit-to-px unit value [settings] ⇒ %return

Converts value from unit to pixels.

unit

Passed: a <AdwLengthUnit>, or one of its symbols.

a length unit

value

Passed: a real number.

a value in unit

settings

Passed, or left out: a <GtkSettings>, or #f.

settings to use, or NULL for default settings

%return

Returned: a real number.

the length in pixels

Procedure: lerp a b t ⇒ %return

Computes the linear interpolation between a and b for t.

a

Passed: a real number.

the start

b

Passed: a real number.

the end

t

Passed: a real number.

the interpolation rate

%return

Returned: a real number.

the computed value

Procedure: rgba-to-standalone! rgba dark standalone-rgba ⇒ standalone-rgba

Adjusts rgba to be suitable as a standalone color.

It will typically be darker for light background, and lighter for dark background, ensuring contrast.

rgba

Passed: a <GdkRGBA>.

a background color

dark

Passed: a boolean.

Whether to calculate standalone color for light or dark background

standalone-rgba

Passed, filled in, and returned: a <GdkRGBA>.

return location for the standalone color