[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentytwentyone/classes/ -> class-twenty-twenty-one-custom-colors.php (summary)

Custom Colors Class

File Size: 167 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Twenty_Twenty_One_Custom_Colors:: (7 methods):
  __construct()
  custom_get_readable_color()
  generate_custom_color_variables()
  custom_color_variables()
  editor_custom_color_variables()
  get_relative_luminance_from_hex()
  body_class()


Class: Twenty_Twenty_One_Custom_Colors  - X-Ref

This class is in charge of color customization via the Customizer.

__construct()   X-Ref
Instantiate the object.

since: Twenty Twenty-One 1.0

custom_get_readable_color( $background_color )   X-Ref
Determine the luminance of the given color and then return #fff or #000 so that the text is always readable.

return: string (hex color)
since: Twenty Twenty-One 1.0
param: string $background_color The background color.

generate_custom_color_variables( $context = null )   X-Ref
Generate color variables.

Adjust the color value of the CSS variables depending on the background color theme mod.
Both text and link colors needs to be updated.
The code below needs to be updated, because the colors are no longer theme mods.

return: string
since: Twenty Twenty-One 1.0
param: string|null $context Can be "editor" or null.

custom_color_variables()   X-Ref
Customizer & frontend custom color variables.

return: void
since: Twenty Twenty-One 1.0

editor_custom_color_variables()   X-Ref
Editor custom color variables.

return: void
since: Twenty Twenty-One 1.0

get_relative_luminance_from_hex( $hex )   X-Ref
Get luminance from a HEX color.

return: int Returns a number (0-255).
since: Twenty Twenty-One 1.0
param: string $hex The HEX color.

body_class( $classes )   X-Ref
Adds a class to <body> if the background-color is dark.

return: array
since: Twenty Twenty-One 1.0
param: array $classes The existing body classes.



Generated: Thu Dec 5 01:00:03 2024 Cross-referenced by PHPXref 0.7.1