Lumina Theme Architecture

body-classes.php

File: body-classes.php Theme: Shared Body Class Functions

Centralized Document Layout Engine. Directly queries global styles background color and custom theme settings to apply:

  1. Canvas Luminance: is-dark-background | is-light-background
  2. Theme Engine Mode: is-dark-theme | is-light-theme
  3. Color Scheme Variant: color-scheme-{$slug}

Transient keys are dynamically scoped per active theme/child-theme slug.

Table of Contents

Constants

TRANSIENT_PREFIX  : string = 'xs_theme_meta_'
Dynamic transient key prefix used for caching site-wide lightness metadata.

Functions

get_transient_key()  : string
Returns a transient key dynamically scoped to the current theme/child-theme slug.
hsl_to_rgb()  : array{0: int, 1: int, 2: int}
Converts HSL/HSLA color channels down to baseline RGB values (0–255 range).
hue_to_rgb()  : float|int
Helper function for HSL conversion steps.
add_body_classes()  : array<string|int, mixed>
Appends dynamic canvas luminance, theme mode, and color scheme variant classes to the body class array.
clear_lightness_transient()  : void
Clears the lightness transient metadata cache for the active theme.

Constants

TRANSIENT_PREFIX

Dynamic transient key prefix used for caching site-wide lightness metadata.

public string TRANSIENT_PREFIX = 'xs_theme_meta_'

Functions

get_transient_key()

Returns a transient key dynamically scoped to the current theme/child-theme slug.

get_transient_key() : string
Return values
string —

WordPress Transient Database Key (Prefix + Theme Slug)

hsl_to_rgb()

Converts HSL/HSLA color channels down to baseline RGB values (0–255 range).

hsl_to_rgb(float|int $h, float|int $s, float|int $l) : array{0: int, 1: int, 2: int}
Parameters
$h : float|int

Hue value (0 to 360).

$s : float|int

Saturation value (0 to 100).

$l : float|int

Lightness value (0 to 100).

Return values
array{0: int, 1: int, 2: int} —

Array containing red, green, and blue integer channels.

hue_to_rgb()

Helper function for HSL conversion steps.

hue_to_rgb(float|int $p, float|int $q, float|int $t) : float|int
Parameters
$p : float|int

First color helper value.

$q : float|int

Second color helper value.

$t : float|int

Channel tint/hue component value.

Return values
float|int —

Calculated RGB color component.

add_body_classes()

Appends dynamic canvas luminance, theme mode, and color scheme variant classes to the body class array.

add_body_classes(array<string|int, mixed> $classes) : array<string|int, mixed>
Parameters
$classes : array<string|int, mixed>

Array of existing body class names.

Return values
array<string|int, mixed> —

Array of modified body class names.

clear_lightness_transient()

Clears the lightness transient metadata cache for the active theme.

clear_lightness_transient() : void
On this page

Search results