[wp-trac] [WordPress Trac] #28324: Add primary and secondary color definitions to admin color schemes and add function to retrieve color scheme info
WordPress Trac
noreply at wordpress.org
Wed May 21 14:31:37 UTC 2014
#28324: Add primary and secondary color definitions to admin color schemes and add
function to retrieve color scheme info
--------------------------------+-----------------------------
Reporter: bamadesigner | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: trunk
Severity: normal | Keywords:
Focuses: ui, administration |
--------------------------------+-----------------------------
I'd like to be able to implement a user's selected admin color scheme into
my plugin admin UI design but, at this point in time, using
wp_admin_css_color() to register a color scheme only asks for an array of
colors and then depends on a stylesheet to use said colors so there's no
way for me to, at the very least, detect a primary and secondary color to
use in my design.
From what I can tell, most color schemes have what they consider to be the
primary and secondary color, and they use those colors for primary buttons
and admin menu links and such, but there's no way for someone else to
detect those color values.
It would also be nice if there was a function to retrieve the color scheme
info. Perhaps something like this:
{{{
function get_user_admin_color() {
global $_wp_admin_css_colors;
if ( ( $user_admin_color = get_user_option( 'admin_color' ) )
&& isset( $_wp_admin_css_colors[ $user_admin_color ] ) ) {
return $_wp_admin_css_colors[ $user_admin_color ];
}
return false;
}
}}}
But the big request is changes to the wp_admin_css_color() function so, at
the very least, a primary and secondary color can be defined and stored in
$_wp_admin_css_colors. Perhaps something like this?
{{{
function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons
= array(), $primary_color = NULL, $secondary_color = NULL ) {
global $_wp_admin_css_colors;
// If a primary color is not defined, use first color from $colors
array
if ( ! isset( $primary_color ) && count( $colors ) >= 1 )
$primary_color = $colors[0];
// If a secondary color is not defined, use second color from $colors
array
if ( ! isset( $secondary_color ) && count( $colors ) >= 2 )
$secondary_color = $colors[1];
if ( ! isset( $_wp_admin_css_colors ) )
$_wp_admin_css_colors = array();
$_wp_admin_css_colors[$key] = (object) array(
'name' => $name,
'url' => $url,
'primary_color' => $primary_color,
'secondary_color => $secondary_color,
'colors' => $colors,
'icon_colors' => $icons,
);
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28324>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list