wp_admin_css_color() WordPress Function

This function allows you to change the CSS colors in the WordPress admin area.

wp_admin_css_color( string $key, string $name, string $url, array $colors = array(), array $icons = array() ) #

Registers an admin color scheme css file.


Description

Allows a plugin to register a new admin color scheme. For example:

wp_admin_css_color( 'classic', __( 'Classic' ), admin_url( "css/colors-classic.css" ), array(
    '#07273E', '#14568A', '#D54E21', '#2683AE'
) );

Top ↑

Parameters

$key

(string)(Required)The unique key for this theme.

$name

(string)(Required)The name of the theme.

$url

(string)(Required)The URL of the CSS file containing the color scheme.

$colors

(array)(Optional) An array of CSS color definition strings which are used to give the user a feel for the theme.

Default value: array()

$icons

(array)(Optional)CSS color definitions used to color any SVG icons.

  • 'base'
    (string) SVG icon base color.
  • 'focus'
    (string) SVG icon color on focus.
  • 'current'
    (string) SVG icon color of current admin menu link.

Default value: array()


Top ↑

Source

File: wp-includes/general-template.php

function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() ) {
	global $_wp_admin_css_colors;

	if ( ! isset( $_wp_admin_css_colors ) ) {
		$_wp_admin_css_colors = array();
	}

	$_wp_admin_css_colors[ $key ] = (object) array(
		'name'        => $name,
		'url'         => $url,
		'colors'      => $colors,
		'icon_colors' => $icons,
	);
}


Top ↑

Changelog

Changelog
VersionDescription
2.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More