-
Notifications
You must be signed in to change notification settings - Fork 0
/
flat-admin-color-scheme.php
executable file
·57 lines (48 loc) · 1.48 KB
/
flat-admin-color-scheme.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* Plugin Name: Flat Admin Color Scheme
* Description: A WordPress admin color scheme
* Author: Justin Peacock
* Version: 1.0.0
* Text Domain: flat-color-scheme
* License: GPL2
*/
class flat_Admin_Color_Scheme
{
function __construct()
{
add_action('admin_enqueue_scripts', array($this, 'load_default_css'));
add_action('admin_init', array($this, 'add_color_scheme'));
}
/**
* Register the custom admin color scheme
*
* @TODO Implement RTL stylesheets
* @TODO Implement Icon colors
*/
function add_color_scheme()
{
wp_admin_css_color(
'flat',
__('Flat', 'flat-color-scheme'),
plugins_url('style.css', __FILE__),
array('#34495e', '#2c3e50', '#ecf0f1', '#1abc9c')
);
}
/**
* Make sure core's default `colors.css` gets enqueued, since we can't
* @import it from a plugin stylesheet. Also force-load the default colors
* on the profile screens, so the JS preview isn't broken-looking.
*
* Copied from Admin Color Schemes - http://wordpress.org/plugins/admin-color-schemes/
*/
function load_default_css()
{
global $wp_styles;
$color_scheme = get_user_option('admin_color');
if ('flat' === $color_scheme || in_array(get_current_screen()->base, array('profile', 'profile-network'))) {
$wp_styles->registered['colors']->deps[] = 'colors-fresh';
}
}
}
new flat_Admin_Color_Scheme();