wp_admin_css_color

Registers an admin colour scheme css file.

Description

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

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

#07273E, #14568A, #D54E21, #2683AE

Parameters (5)

0. $key (string)
The unique key for this theme.
1. $name (string)
The name of the theme.
2. $url (string)
The URL of the CSS file containing the color scheme.
3. $colors — Optional. (array) => array()
An array of CSS color definition strings which are used to give the user a feel for the theme.
4. $icons — Optional. (array) => array()
CSS color definitions used to color any SVG icons.

Options

  • base (string) => ''

    SVG icon base color.

  • focus (string) => ''

    SVG icon color on focus.

array(

    /**
     * SVG icon base color.
     *
     * @type string
     * @default ''
     */
    'base' => '',

    /**
     * SVG icon color on focus.
     *
     * @type string
     * @default ''
     */
    'focus' => ''
);        


Usage

  1. if ( !function_exists( 'wp_admin_css_color' ) ) { 
  2. require_once ABSPATH . WPINC . '/general-template.php'; 
  3.  
  4. // The unique key for this theme. 
  5. $key = ''; 
  6.  
  7. // The name of the theme. 
  8. $name = ''; 
  9.  
  10. // The URL of the CSS file containing the color scheme. 
  11. $url = ''; 
  12.  
  13. // Optional. An array of CSS color definition strings which are used 
  14. // to give the user a feel for the theme. 
  15. $colors = array(); 
  16.  
  17. // Optional. CSS color definitions used to color any SVG icons. 
  18. $icons = array( 
  19. 'base' => '', 
  20. 'focus' => '' 
  21. ); 
  22.  
  23. // NOTICE! Understand what this does before running. 
  24. $result = wp_admin_css_color($key, $name, $url, $colors, $icons); 
  25.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/general-template.php  
  1. function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() ) { 
  2. global $_wp_admin_css_colors; 
  3.  
  4. if ( !isset($_wp_admin_css_colors) ) 
  5. $_wp_admin_css_colors = array(); 
  6.  
  7. $_wp_admin_css_colors[$key] = (object) array( 
  8. 'name' => $name,  
  9. 'url' => $url,  
  10. 'colors' => $colors,  
  11. 'icon_colors' => $icons,  
  12. );