Make WordPress Core

Ticket #25858: 25858.colors.3.diff

File 25858.colors.3.diff, 30.7 KB (added by ryelle, 11 years ago)
  • Gruntfile.js

     
    7676                                }
    7777                        }
    7878                },
     79                sass: {
     80                        colors: {
     81                                options: {
     82                                        style: 'expanded',
     83                                        sourcemap: true,
     84                                        noCache: true
     85                                },
     86                                files : [{
     87                                        expand: true,
     88                                        cwd: SOURCE_DIR,
     89                                        dest: BUILD_DIR,
     90                                        ext: '.css',
     91                                        src: ['wp-admin/css/color-schemes/*/colors.scss']
     92                                }]
     93                        }
     94                },
    7995                cssmin: {
    8096                        core: {
    8197                                expand: true,
     
    98114                                        'wp-admin/css/*-rtl.css',
    99115                                        'wp-includes/css/*-rtl.css'
    100116                                ]
     117                        },
     118                        colors: {
     119                                expand: true,
     120                                cwd: BUILD_DIR,
     121                                dest: BUILD_DIR,
     122                                ext: '.min.css',
     123                                src: [
     124                                        'wp-admin/css/color-schemes/**/*.css'
     125                                ]
    101126                        }
    102127                },
    103128                cssjanus: {
     
    316341                        test: {
    317342                                files: ['tests/qunit/**'],
    318343                                tasks: ['qunit']
     344                        },
     345                        colors: {
     346                                files: [SOURCE_DIR + 'wp-admin/css/color-schemes/**'],
     347                                tasks: ['sass:colors']
    319348                        }
    320349                }
    321350        });
     
    327356
    328357        // RTL task.
    329358        grunt.registerTask('rtl', ['cssjanus:core']);
     359       
     360        grunt.registerTask('colors', ['sass:colors', 'cssmin:colors']);
    330361
    331362        // Build task.
    332         grunt.registerTask('build', ['clean:all', 'copy:all', 'rtl', 'cssmin:core', 'cssmin:rtl',
     363        grunt.registerTask('build', ['clean:all', 'copy:all', 'rtl', 'colors', 'cssmin:core', 'cssmin:rtl',
    333364                'uglify:core', 'uglify:tinymce', 'concat:tinymce', 'compress:tinymce', 'clean:tinymce']);
    334365
    335366        // Testing tasks.
  • package.json

     
    1313    "grunt-contrib-clean": "~0.5.0",
    1414    "grunt-contrib-copy": "~0.4.1",
    1515    "grunt-contrib-cssmin": "~0.6.1",
     16    "grunt-contrib-sass": "~0.5.0",
    1617    "grunt-contrib-qunit": "~0.2.2",
    1718    "grunt-contrib-uglify": "~0.2.2",
    1819    "grunt-contrib-watch": "~0.5.1",
  • src/wp-admin/admin-ajax.php

     
    5858        'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment',
    5959        'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor',
    6060        'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs',
     61        'save-user-color-scheme',
    6162);
    6263
    6364// Register core Ajax calls.
  • src/wp-admin/css/color-schemes/_admin.scss

     
     1
     2@import 'variables';
     3@import 'mixins';
     4
     5
     6html {
     7        background: $body-background;
     8}
     9
     10
     11/* Links */
     12
     13a {
     14        color: $link;
     15
     16        &:hover,
     17        &:active,
     18        &:focus {
     19                color: $link-focus;
     20        }
     21}
     22
     23#rightnow a:hover,
     24#media-upload a.del-link:hover,
     25div.dashboard-widget-submit input:hover,
     26.subsubsub a:hover,
     27.subsubsub a.current:hover,
     28.ui-tabs-nav a:hover {
     29        color: $link-focus;
     30}
     31
     32
     33/* Forms */
     34
     35input[type=checkbox]:checked:before {
     36    color: $form-checked;
     37}
     38
     39input[type=radio]:checked:before {
     40    background: $form-checked;
     41}
     42
     43.wp-core-ui input[type="reset"]:hover,
     44.wp-core-ui input[type="reset"]:active {
     45        color: $link-focus;
     46}
     47
     48
     49/* Core UI */
     50
     51.wp-core-ui {
     52        .button-primary {
     53                @include button( $button-color );
     54        }
     55
     56        .mp6-primary {
     57                color: $text-color;
     58                background-color: $base-color;
     59        }
     60        .mp6-text-primary {
     61                color: $base-color;
     62        }
     63
     64        .mp6-highlight {
     65                color: $menu-highlight-text;
     66                background-color: $menu-highlight-background;
     67        }
     68        .mp6-text-highlight {
     69                color: $menu-highlight-background;
     70        }
     71
     72        .mp6-notification {
     73                color: $menu-bubble-text;
     74                background-color: $menu-bubble-background;
     75        }
     76        .mp6-text-notification {
     77                color: $menu-bubble-background;
     78        }
     79
     80        .mp6-text-icon {
     81                color: $menu-icon;
     82        }
     83}
     84
     85
     86/* List tables */
     87
     88.wrap .add-new-h2:hover,
     89#add-new-comment a:hover,
     90.tablenav .tablenav-pages a:hover,
     91.tablenav .tablenav-pages a:focus {
     92        color: $menu-text;
     93        background-color: $menu-background;
     94}
     95
     96.view-switch a.current:before {
     97        color: $menu-background;
     98}
     99
     100.view-switch a:hover:before {
     101        color: $menu-bubble-background;
     102}
     103
     104.post-com-count:hover:after {
     105        border-top-color: $menu-background;
     106}
     107.post-com-count:hover span {
     108        color: $menu-text;
     109        background-color: $menu-background;
     110}
     111
     112strong .post-com-count:after {
     113        border-top-color: $menu-bubble-background;
     114}
     115strong .post-com-count span {
     116        background-color: $menu-bubble-background;
     117}
     118
     119
     120/* Admin Menu */
     121
     122#adminmenuback,
     123#adminmenuwrap {
     124        background: $menu-background;
     125}
     126
     127#adminmenu a {
     128        color: $menu-text;
     129}
     130
     131#adminmenu div.wp-menu-image:before {
     132        color: $menu-icon;
     133}
     134
     135#adminmenu a:hover,
     136#adminmenu li.menu-top:hover,
     137#adminmenu li.opensub > a.menu-top,
     138#adminmenu li > a.menu-top:focus {
     139        color: $menu-highlight-text;
     140        background-color: $menu-highlight-background;
     141}
     142
     143#adminmenu li.menu-top:hover div.wp-menu-image:before,
     144#adminmenu li.opensub > a.menu-top div.wp-menu-image:before {
     145        color: $menu-highlight-icon;
     146}
     147
     148
     149/* Admin Menu: submenu */
     150
     151#adminmenu .wp-submenu,
     152#adminmenu .wp-has-current-submenu .wp-submenu,
     153#adminmenu .wp-has-current-submenu.opensub .wp-submenu,
     154.folded #adminmenu .wp-has-current-submenu .wp-submenu,
     155#adminmenu a.wp-has-current-submenu:focus + .wp-submenu {
     156        background: $menu-submenu-background;
     157}
     158
     159#adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after {
     160        border-right-color: $menu-submenu-background;
     161}
     162
     163#adminmenu .wp-submenu .wp-submenu-head {
     164        color: $menu-submenu-text;
     165}
     166
     167#adminmenu .wp-submenu a,
     168#adminmenu .wp-has-current-submenu .wp-submenu a,
     169.folded #adminmenu .wp-has-current-submenu .wp-submenu a,
     170#adminmenu a.wp-has-current-submenu:focus + .wp-submenu a,
     171#adminmenu .wp-has-current-submenu.opensub .wp-submenu a {
     172        color: $menu-submenu-text;
     173
     174        &:focus, &:hover {
     175                color: $menu-submenu-focus-text;
     176        }
     177}
     178
     179
     180/* Admin Menu: current */
     181
     182#adminmenu .wp-submenu li.current a,
     183#adminmenu a.wp-has-current-submenu:focus + .wp-submenu li.current a,
     184#adminmenu .wp-has-current-submenu.opensub .wp-submenu li.current a {
     185        color: $menu-submenu-current-text;
     186
     187        &:hover, &:focus {
     188                color: $menu-submenu-focus-text;
     189        }
     190}
     191
     192ul#adminmenu a.wp-has-current-submenu:after,
     193ul#adminmenu > li.current > a.current:after {
     194    border-right-color: $body-background;
     195}
     196
     197#adminmenu li.current a.menu-top,
     198#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,
     199#adminmenu li.wp-has-current-submenu .wp-submenu .wp-submenu-head,
     200.folded #adminmenu li.current.menu-top {
     201        color: $menu-current-text;
     202        background: $menu-current-background;
     203}
     204
     205#adminmenu li.wp-has-current-submenu div.wp-menu-image:before {
     206        color: $menu-current-icon;
     207}
     208
     209
     210/* Admin Menu: bubble */
     211
     212#adminmenu .awaiting-mod,
     213#adminmenu .update-plugins {
     214        color: $menu-bubble-text;
     215        background: $menu-bubble-background;
     216}
     217
     218#adminmenu li.current a .awaiting-mod,
     219#adminmenu li a.wp-has-current-submenu .update-plugins,
     220#adminmenu li:hover a .awaiting-mod,
     221#adminmenu li.menu-top:hover > a .update-plugins {
     222        color: $menu-bubble-current-text;
     223        background: $menu-bubble-current-background;
     224}
     225
     226
     227/* Admin Menu: collapse button */
     228
     229#collapse-menu {
     230    color: $menu-collapse-text;
     231}
     232
     233#collapse-menu:hover {
     234    color: $menu-collapse-focus-text;
     235}
     236
     237#collapse-button div:after {
     238    color: $menu-collapse-icon;
     239}
     240
     241#collapse-menu:hover #collapse-button div:after {
     242    color: $menu-collapse-focus-icon;
     243}
     244
     245
     246/* Admin Bar */
     247
     248#wpadminbar {
     249        color: $menu-text;
     250        background: $menu-background;
     251}
     252
     253#wpadminbar .ab-item,
     254#wpadminbar a.ab-item,
     255#wpadminbar > #wp-toolbar > #wp-admin-bar-root-default span.ab-label,
     256#wpadminbar > #wp-toolbar > #wp-admin-bar-top-secondary span.ab-label,
     257#wpadminbar > #wp-toolbar > #wp-admin-bar-top-secondary span.noticon {
     258        color: $menu-text;
     259}
     260
     261#wpadminbar .ab-icon,
     262#wpadminbar .ab-item:before {
     263        color: $menu-icon;
     264}
     265
     266#wpadminbar .ab-top-menu > li:hover > .ab-item,
     267#wpadminbar .ab-top-menu > li.hover > .ab-item,
     268#wpadminbar > #wp-toolbar > #wp-admin-bar-root-default li:hover span.ab-label,
     269#wpadminbar > #wp-toolbar > #wp-admin-bar-top-secondary li.hover span.ab-label,
     270#wpadminbar .ab-top-menu > li > .ab-item:focus,
     271#wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus,
     272#wpadminbar-nojs .ab-top-menu > li.menupop:hover > .ab-item,
     273#wpadminbar .ab-top-menu > li.menupop.hover > .ab-item {
     274        color: $menu-highlight-text;
     275        background: $menu-submenu-background;
     276}
     277
     278#wpadminbar li:hover .ab-icon,
     279#wpadminbar li:hover > .ab-item:before {
     280        color: $menu-highlight-icon;
     281}
     282
     283
     284/* Admin Bar: submenu */
     285
     286#wpadminbar .menupop .ab-sub-wrapper {
     287        background: $menu-submenu-background;
     288}
     289
     290#wpadminbar .quicklinks .menupop ul.ab-sub-secondary {
     291        background: $menu-submenu-background-alt;
     292}
     293
     294#wpadminbar .ab-submenu .ab-item,
     295#wpadminbar .quicklinks .menupop ul li a,
     296#wpadminbar .quicklinks .menupop.hover ul li a,
     297#wpadminbar-nojs .quicklinks .menupop:hover ul li a {
     298        color: $menu-submenu-text;
     299}
     300
     301#wpadminbar .quicklinks li .blavatar,
     302#wpadminbar .menupop .menupop > .ab-item:before {
     303        color: $menu-icon;
     304}
     305
     306#wpadminbar .quicklinks .menupop ul li a:hover,
     307#wpadminbar .quicklinks .menupop.hover ul li a:hover,
     308#wpadminbar .quicklinks .menupop .ab-sub-secondary > li:hover > a,
     309#wpadminbar .quicklinks .menupop .ab-sub-secondary > li.hover > a,
     310#wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover {
     311        color: $menu-submenu-focus-text;
     312}
     313
     314#wpadminbar .quicklinks li a:hover .blavatar,
     315#wpadminbar .menupop .menupop > .ab-item:hover:before {
     316        color: $menu-submenu-focus-text;
     317}
     318
     319
     320/* Admin Bar: search */
     321
     322#wpadminbar #adminbarsearch:before {
     323        color: $menu-icon;
     324}
     325
     326#wpadminbar > #wp-toolbar > #wp-admin-bar-top-secondary > #wp-admin-bar-search #adminbarsearch input.adminbar-input:focus {
     327        color: $menu-text;
     328        background: $adminbar-input-background;
     329}
     330
     331#wpadminbar #adminbarsearch .adminbar-input::-webkit-input-placeholder { color: $menu-text; opacity: .7; }
     332#wpadminbar #adminbarsearch .adminbar-input:-moz-placeholder { color: $menu-text; opacity: .7; }
     333#wpadminbar #adminbarsearch .adminbar-input::-moz-placeholder { color: $menu-text; opacity: .7; }
     334#wpadminbar #adminbarsearch .adminbar-input:-ms-input-placeholder { color: $menu-text; opacity: .7; }
     335
     336
     337/* Admin Bar: my account */
     338
     339#wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar > a img {
     340        border-color: $adminbar-avatar-frame;
     341        background-color: $adminbar-avatar-frame;
     342}
     343
     344#wpadminbar #wp-admin-bar-user-info .display-name {
     345        color: $menu-text;
     346}
     347
     348#wpadminbar #wp-admin-bar-user-info .username {
     349        color: $menu-submenu-text;
     350}
     351
     352
     353/* Pointers */
     354
     355.wp-pointer .wp-pointer-content h3 {
     356        background-color: $highlight-color;
     357}
     358
     359.wp-pointer.wp-pointer-top .wp-pointer-arrow,
     360.wp-pointer.wp-pointer-undefined .wp-pointer-arrow {
     361        border-bottom-color: $highlight-color;
     362}
     363
     364
     365/* Responsive Component */
     366
     367div#moby6-toggle a:before {
     368        color: $menu-icon;
     369}
     370
     371.moby6-open div#moby6-toggle a {
     372        // ToDo: make inset border
     373        border-color: transparent;
     374        background: $menu-highlight-background;
     375}
     376 No newline at end of file
  • src/wp-admin/css/color-schemes/_mixins.scss

    Property changes on: src/wp-admin/css/color-schemes/_admin.scss
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*
     2 * Button mixin- creates 3d-ish button effect with correct
     3 * highlights/shadows, based on a base color.
     4 */
     5@mixin button( $button-color, $text-color: white ) {
     6        background: $button-color;
     7        border-color: darken( $button-color, 10% );
     8        color: $text-color;
     9        -webkit-box-shadow: inset 0 1px 0 lighten( $button-color, 15% ), 0 1px 0 rgba(0,0,0,.15);
     10        box-shadow: inset 0 1px 0 lighten( $button-color, 15% ), 0 1px 0 rgba(0,0,0,.15);
     11
     12        &:hover,
     13        &:focus {
     14                background: darken( $button-color, 8% );
     15                border-color: darken( $button-color, 15% );
     16                color: $text-color;
     17                -webkit-box-shadow: inset 0 1px 0 lighten( $button-color, 10% ), 0 1px 0 rgba(0,0,0,.15);
     18                box-shadow: inset 0 1px 0 lighten( $button-color, 10% ), 0 1px 0 rgba(0,0,0,.15);
     19        }
     20
     21        &:active {
     22                background: darken( $button-color, 8% );
     23                border-color: darken( $button-color, 15% );
     24                color: $text-color;
     25                -webkit-box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
     26                box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
     27        }
     28
     29        &[disabled],
     30        &:disabled,
     31        &.button-primary-disabled {
     32                color: hsl( hue( $button-color ), 10%, 80% ) !important;
     33                background: darken( $button-color, 8% ) !important;
     34                border-color: darken( $button-color, 15% ) !important;
     35                text-shadow: none !important;
     36        }
     37}
     38 No newline at end of file
  • src/wp-admin/css/color-schemes/_variables.scss

    Property changes on: src/wp-admin/css/color-schemes/_mixins.scss
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1// assign default value to all undefined variables
     2
     3
     4// core variables
     5
     6$text-color: #fff !default;
     7$base-color: #222 !default;
     8$icon-color: hsl( hue( $base-color ), 7%, 95% ) !default;
     9$highlight-color: #0074a2 !default;
     10$notification-color: #d54e21 !default;
     11
     12
     13// global
     14
     15$body-background: #eee !default;
     16
     17$link: #0074a2 !default;
     18$link-focus: lighten( $link, 10% ) !default;
     19
     20$button-color: $highlight-color !default;
     21$form-checked: $highlight-color !default;
     22
     23
     24// admin menu & admin-bar
     25
     26$menu-text: $text-color !default;
     27$menu-icon: $icon-color !default;
     28$menu-background: $base-color !default;
     29
     30$menu-highlight-text: $text-color !default;
     31$menu-highlight-icon: $text-color !default;
     32$menu-highlight-background: $highlight-color !default;
     33
     34$menu-current-text: $menu-highlight-text !default;
     35$menu-current-icon: $menu-highlight-icon !default;
     36$menu-current-background: $menu-highlight-background !default;
     37
     38$menu-submenu-text: mix( $base-color, $text-color, 30% ) !default;
     39$menu-submenu-background: darken( $base-color, 7% ) !default;
     40$menu-submenu-background-alt: desaturate( lighten( $menu-background, 7% ), 7% ) !default;
     41
     42$menu-submenu-focus-text: $highlight-color !default;
     43$menu-submenu-current-text: $text-color !default;
     44
     45$menu-bubble-text: $text-color !default;
     46$menu-bubble-background: $notification-color !default;
     47$menu-bubble-current-text: $text-color !default;
     48$menu-bubble-current-background: $menu-submenu-background !default;
     49
     50$menu-collapse-text: $menu-icon !default;
     51$menu-collapse-icon: $menu-icon !default;
     52$menu-collapse-focus-text: $text-color !default;
     53$menu-collapse-focus-icon: $menu-highlight-icon !default;
     54
     55$adminbar-avatar-frame: lighten( $menu-background, 7% ) !default;
     56$adminbar-input-background: lighten( $menu-background, 7% ) !default;
     57
     58$menu-customizer-text: mix( $base-color, $text-color, 40% ) !default;
  • src/wp-admin/css/color-schemes/blue/colors.scss

    Property changes on: src/wp-admin/css/color-schemes/_variables.scss
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1$base-color: #52accc;
     2$icon-color: #e5f8ff;
     3$highlight-color: #096484;
     4$notification-color: #e1a948;
     5$button-color: #e1a948;
     6
     7$menu-submenu-text: #e2ecf1;
     8$menu-submenu-focus-text: #fff;
     9$menu-submenu-background: #4796b3;
     10
     11@import "../../colors-fresh.css";
     12@import "../_admin.scss";
  • src/wp-admin/css/color-schemes/light/colors.scss

    Property changes on: src/wp-admin/css/color-schemes/blue/colors.scss
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1$base-color: #e5e5e5;
     2$icon-color: #999;
     3$text-color: #333;
     4$highlight-color: #04a4cc;
     5$notification-color: #d64e07;
     6
     7$body-background: #f5f5f5;
     8
     9$menu-highlight-text: #fff;
     10$menu-highlight-icon: #ccc;
     11$menu-highlight-background: #888;
     12
     13$menu-bubble-text: #fff;
     14$menu-avatar-frame: #aaa;
     15$menu-submenu-background: #fff;
     16
     17$menu-collapse-text: #777;
     18$menu-collapse-focus-icon: #555;
     19
     20@import "../../colors-fresh.css";
     21@import "../_admin.scss";
     22
     23/* temporary fix for admin-bar hover color */
     24#wpadminbar .ab-top-menu > li:hover > .ab-item,
     25#wpadminbar .ab-top-menu > li.hover > .ab-item,
     26#wpadminbar > #wp-toolbar > #wp-admin-bar-root-default li:hover span.ab-label,
     27#wpadminbar > #wp-toolbar > #wp-admin-bar-top-secondary li.hover span.ab-label,
     28#wpadminbar .ab-top-menu > li > .ab-item:focus,
     29#wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus,
     30#wpadminbar-nojs .ab-top-menu > li.menupop:hover > .ab-item,
     31#wpadminbar .ab-top-menu > li.menupop.hover > .ab-item {
     32        color: $text-color;
     33}
  • src/wp-admin/css/color-schemes/midnight/colors.scss

    Property changes on: src/wp-admin/css/color-schemes/light/colors.scss
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1$base-color: #363b3f;
     2$highlight-color: #e14d43;
     3$notification-color: #69a8bb;
     4
     5@import "../../colors-fresh.css";
     6@import "../_admin.scss";
  • src/wp-admin/css/color-schemes/seaweed/colors.scss

    Property changes on: src/wp-admin/css/color-schemes/midnight/colors.scss
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1$base-color: #15757a;
     2$icon-color: #e1f9fa;
     3$highlight-color: #a8c274;
     4$notification-color: #e78229;
     5
     6$form-checked: $base-color;
     7
     8@import "../../colors-fresh.css";
     9@import "../_admin.scss";
  • src/wp-admin/css/wp-admin.css

    Property changes on: src/wp-admin/css/color-schemes/seaweed/colors.scss
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
    56405640        width: auto;
    56415641}
    56425642
    5643 .form-table div.color-option {
    5644         display: block;
    5645         clear: both;
    5646         margin-top: 12px;
    5647 }
    5648 
    56495643.form-table input.tog {
    56505644        margin-top: 2px;
    56515645        margin-right: 2px;
     
    56575651        margin-bottom: 0;
    56585652}
    56595653
    5660 .form-table table.color-palette {
    5661         vertical-align: bottom;
    5662         float: left;
    5663         margin: -12px 3px 11px;
    5664 }
    5665 
    5666 .form-table .color-palette td {
    5667         border-width: 1px 1px 0;
    5668         border-style: solid solid none;
    5669         height: 10px;
    5670         line-height: 20px;
    5671         width: 10px;
    5672 }
    5673 
    5674 
    56755654.form-table td fieldset label {
    56765655        margin: 0.25em 0 0.5em !important;
    56775656        display: inline-block;
     
    63346313        width: 25em;
    63356314}
    63366315
     6316.picker-dropdown {
     6317        background: #fcfcfc;
     6318        border: 1px solid #dedede;
     6319        margin-right: 12%;
     6320        max-width: 270px;
     6321        position: relative;
     6322        width: auto;
     6323}
     6324
     6325.picker-dropdown.dropdown-current {
     6326        padding: 20px;
     6327        margin-bottom: 15px;
     6328        cursor: pointer;
     6329}
     6330
     6331.picker-dropdown.dropdown-container {
     6332        display: none;
     6333        position: absolute;
     6334        width: 340px;
     6335        border-top: none;
     6336        -webkit-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
     6337        box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
     6338        z-index: 1;
     6339}
     6340
     6341.picker-expanded .picker-dropdown.dropdown-container {
     6342        display: block;
     6343}
     6344
     6345.picker-dropdown.dropdown-container:before,
     6346.picker-dropdown.dropdown-container:after {
     6347        content: "\0020";
     6348        display: block;
     6349        position: absolute;
     6350        top: -10px;
     6351        left: 150px;
     6352        z-index: 2;
     6353        width: 0;
     6354        height: 0;
     6355        overflow: hidden;
     6356        border: solid 11px transparent;
     6357        border-top: 0;
     6358        border-bottom-color: #fefefe;
     6359}
     6360
     6361.picker-dropdown.dropdown-container:before {
     6362        top: -11px;
     6363        z-index: 1;
     6364        border-bottom-color: #dedede;
     6365}
     6366
     6367.picker-dropdown-arrow {
     6368        position: absolute;
     6369        top: -1px;
     6370        right: -42px;
     6371        display: block;
     6372        width: 40px;
     6373        height: 100%;
     6374        background: white;
     6375        text-align: center;
     6376        border: 1px solid #dedede;
     6377        border-left-width: 0;
     6378        cursor: pointer;
     6379}
     6380
     6381.picker-dropdown-arrow:before {
     6382        font: 20px/91px dashicons;
     6383        content: '\f140';
     6384}
     6385
     6386.picker-expanded .picker-dropdown-arrow:before {
     6387        content: '\f142';
     6388}
     6389
     6390.color-option {
     6391        display: block;
     6392        padding: 20px;
     6393        border-top: 1px solid #dedede;
     6394}
     6395
     6396.color-option:hover,
     6397.color-option.selected {
     6398        background: #f2f8fa;
     6399}
     6400
     6401.color-palette {
     6402        width: 100%;
     6403        border-spacing: 0;
     6404        border-collapse: collapse;
     6405}
     6406.color-palette td {
     6407        height: 20px;
     6408        padding: 0;
     6409        border: none;
     6410}
     6411
     6412.color-option {
     6413        cursor: pointer;
     6414}
     6415
     6416.no-js .dropdown-current {
     6417        display: none;
     6418}
     6419
     6420.no-js .dropdown-container {
     6421        display: block;
     6422        position: static;
     6423}
     6424
     6425.no-js .dropdown-container:before,
     6426.no-js .dropdown-container:after {
     6427        display: none;
     6428}
     6429
    63376430/*------------------------------------------------------------------------------
    63386431  19.0 - Tools
    63396432------------------------------------------------------------------------------*/
  • src/wp-admin/includes/ajax-actions.php

     
    22442244        }
    22452245        wp_send_json_success( $return );
    22462246}
     2247
     2248/**
     2249 * Auto-save the selected color scheme for a user
     2250 */
     2251function wp_ajax_save_user_color_scheme() {
     2252        global $_wp_admin_css_colors;
     2253
     2254        $user_id = intval( $_POST[ 'user_id' ] ); // can be replaced by `get_current_user_id` if setting is only save for own profile
     2255        $color_scheme = $_POST[ 'color_scheme' ];
     2256
     2257        if ( ! get_user_by( 'id', $user_id ) )
     2258                wp_die( -1 );
     2259
     2260        if ( ! isset( $_wp_admin_css_colors[ $color_scheme ] ) )
     2261                wp_die( -1 );
     2262
     2263        update_user_option( $user_id, 'admin_color', $color_scheme, true );
     2264        wp_die( 0 );
     2265}
     2266 No newline at end of file
  • src/wp-admin/includes/misc.php

     
    562562 * @since 3.0.0
    563563 */
    564564function admin_color_scheme_picker() {
    565         global $_wp_admin_css_colors, $user_id; ?>
    566 <fieldset><legend class="screen-reader-text"><span><?php _e('Admin Color Scheme')?></span></legend>
    567 <?php
    568 $current_color = get_user_option('admin_color', $user_id);
    569 if ( empty($current_color) )
    570         $current_color = 'fresh';
    571 foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
    572 <div class="color-option"><input name="admin_color" id="admin_color_<?php echo esc_attr( $color ); ?>" type="radio" value="<?php echo esc_attr( $color ); ?>" class="tog" <?php checked($color, $current_color); ?> />
    573         <table class="color-palette">
    574         <tr>
    575         <?php foreach ( $color_info->colors as $html_color ): ?>
    576         <td style="background-color: <?php echo esc_attr( $html_color ); ?>" title="<?php echo esc_attr( $color ); ?>">&nbsp;</td>
    577         <?php endforeach; ?>
    578         </tr>
    579         </table>
     565        global $_wp_admin_css_colors, $user_id;
     566        ksort($_wp_admin_css_colors);
    580567
    581         <label for="admin_color_<?php echo esc_attr( $color ); ?>"><?php echo esc_html( $color_info->name ); ?></label>
    582 </div>
    583         <?php endforeach; ?>
    584 </fieldset>
     568        $current_color = get_user_option( 'admin_color', $user_id );
     569
     570        if ( empty( $current_color ) )
     571                $current_color = 'mp6';
     572
     573        $color_info = $_wp_admin_css_colors[$current_color];
     574?>
     575
     576        <fieldset id="color-picker">
     577                <legend class="screen-reader-text"><span><?php _e( 'Admin Color Scheme' ); ?></span></legend>
     578
     579                <div class="picker-dropdown dropdown-current">
     580                        <div class="picker-dropdown-arrow"></div>
     581                        <label for="admin_color_<?php echo esc_attr( $current_color ); ?>"><?php echo esc_html( $color_info->name ); ?></label>
     582                        <table class="color-palette">
     583                                <tr>
     584                                <?php foreach ( $color_info->colors as $html_color ): ?>
     585                                        <td style="background-color: <?php echo esc_attr( $html_color ); ?>" title="<?php echo esc_attr( $current_color ); ?>">&nbsp;</td>
     586                                <?php endforeach; ?>
     587                                </tr>
     588                        </table>
     589                </div>
     590
     591                <div class="picker-dropdown dropdown-container">
     592
     593                <?php foreach ( $_wp_admin_css_colors as $color => $color_info ) : ?>
     594
     595                        <div class="color-option <?php echo ( $color == $current_color ) ? 'selected' : ''; ?>">
     596                                <input name="admin_color" id="admin_color_<?php echo esc_attr( $color ); ?>" type="radio" value="<?php echo esc_attr( $color ); ?>" class="tog" <?php checked( $color, $current_color ); ?> />
     597                                <input type="hidden" class="css_url" value="<?php echo esc_url( $color_info->url ); ?>" />
     598                                <input type="hidden" class="icon_colors" value="<?php echo esc_attr( json_encode( array( 'icons' => $color_info->icon_colors ) ) ); ?>" />
     599                                <label for="admin_color_<?php echo esc_attr( $color ); ?>"><?php echo esc_html( $color_info->name ); ?></label>
     600                                <table class="color-palette">
     601                                        <tr>
     602                                        <?php foreach ( $color_info->colors as $html_color ): ?>
     603                                                <td style="background-color: <?php echo esc_attr( $html_color ); ?>" title="<?php echo esc_attr( $color ); ?>">&nbsp;</td>
     604                                        <?php endforeach; ?>
     605                                        </tr>
     606                                </table>
     607                        </div>
     608
     609                <?php endforeach; ?>
     610
     611                </div>
     612
     613        </fieldset>
     614
    585615<?php
    586616}
    587617
     618function set_color_scheme_json() {
     619        global $_wp_admin_css_colors;
     620
     621        $color_scheme = get_user_option( 'admin_color' );
     622
     623        if ( isset( $_wp_admin_css_colors[ $color_scheme ]->icon_colors ) ) {
     624                echo '<script type="text/javascript">var mp6_color_scheme = ' . json_encode( array( 'icons' => $_wp_admin_css_colors[ $color_scheme ]->icon_colors ) ) . ";</script>\n";
     625        }
     626}
     627add_action( 'admin_head', 'set_color_scheme_json' );
     628
    588629function _ipad_meta() {
    589630        if ( wp_is_mobile() ) {
    590631                ?>
  • src/wp-admin/js/user-profile.js

     
    7373                                });
    7474                        });
    7575                }
     76       
     77                var $colorpicker = $( '#color-picker' );
     78                var $stylesheet = $( '#colors-css' );
     79                var user_id = $( 'input#user_id' ).val();
     80                var current_user_id = $( 'input[name="checkuser_id"]' ).val();
     81
     82                // dropdown toggle
     83                $colorpicker.on( 'click', '.dropdown-current', function() {
     84                        $colorpicker.toggleClass( 'picker-expanded' );
     85                });
     86
     87                $colorpicker.on( 'click', '.color-option', function() {
     88
     89                        var color_scheme = $( this ).children( 'input[name="admin_color"]' ).val();
     90
     91                        // update selected
     92                        $( this ).siblings( '.selected' ).removeClass( 'selected' )
     93                        $( this ).addClass( 'selected' );
     94                        $( this ).find( 'input' ).prop( 'checked', true );
     95
     96                        // update current
     97                        $colorpicker.find( '.dropdown-current label' ).html( $( this ).children( 'label' ).html() );
     98                        $colorpicker.find( '.dropdown-current table' ).html( $( this ).children( 'table' ).html() );
     99                        $colorpicker.toggleClass( 'picker-expanded' );
     100
     101                        // preview/save color scheme
     102                        if ( user_id == current_user_id ) {
     103
     104                                // repaint icons
     105                                $stylesheet.attr( 'href', $( this ).children( '.css_url' ).val() );
     106                                svgPainter.setColors( $.parseJSON( $( this ).children( '.icon_colors' ).val() ) );
     107                                svgPainter.paint();
     108
     109                                // update user option
     110                                $.post( ajaxurl, {
     111                                        action: 'save-user-color-scheme',
     112                                        color_scheme: color_scheme,
     113                                        user_id: user_id
     114                                });
     115
     116                        }
     117
     118                });
     119
    76120        });
    77121
    78122})(jQuery);
  • src/wp-includes/general-template.php

     
    20852085 * @param string $name The name of the theme.
    20862086 * @param string $url The url of the css file containing the colour scheme.
    20872087 * @param array $colors Optional An array of CSS color definitions which are used to give the user a feel for the theme.
     2088 * @param array $icons Optional An array of CSS color definitions used to color any SVG icons
    20882089 */
    2089 function wp_admin_css_color($key, $name, $url, $colors = array()) {
     2090function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() ) {
    20902091        global $_wp_admin_css_colors;
    20912092
    20922093        if ( !isset($_wp_admin_css_colors) )
    20932094                $_wp_admin_css_colors = array();
    20942095
    2095         $_wp_admin_css_colors[$key] = (object) array('name' => $name, 'url' => $url, 'colors' => $colors);
     2096        $_wp_admin_css_colors[$key] = (object) array(
     2097                'name' => $name,
     2098                'url' => $url,
     2099                'colors' => $colors,
     2100                'icon_colors' => $icons,
     2101        );
    20962102}
    20972103
    20982104/**
     
    21012107 * @since 3.0.0
    21022108 */
    21032109function register_admin_color_schemes() {
    2104         wp_admin_css_color( 'fresh', _x( 'Default', 'admin color scheme' ), admin_url( 'css/colors-fresh.min.css' ),
    2105                 array( '#222', '#333', '#0074a2', '#2ea2cc' ) );
     2110        wp_admin_css_color( 'light', _x( 'Light', 'admin color scheme' ),
     2111                admin_url( 'css/color-schemes/light/colors.min.css' ),
     2112                array( '#e5e5e5', '#999', '#d64e07', '#04a4cc' ),
     2113                array( 'base' => '#999', 'focus' => '#ccc', 'current' => '#ccc' )
     2114        );
     2115
     2116        wp_admin_css_color( 'blue', _x( 'Blue', 'admin color scheme' ),
     2117                admin_url( 'css/color-schemes/blue/colors.min.css' ),
     2118                array( '#096484', '#4796b3', '#52accc', '#74B6CE' ),
     2119                array( 'base' => '#e5f8ff', 'focus' => '#fff', 'current' => '#fff' )
     2120        );
     2121
     2122        wp_admin_css_color( 'midnight', _x( 'Midnight', 'admin color scheme' ),
     2123                admin_url( 'css/color-schemes/midnight/colors.min.css' ),
     2124                array( '#25282b', '#363b3f', '#69a8bb', '#e14d43' ),
     2125                array( 'base' => '#f1f2f3', 'focus' => '#fff', 'current' => '#fff' )
     2126        );
     2127
     2128        wp_admin_css_color( 'seaweed', _x( 'Seaweed', 'admin color scheme' ),
     2129                admin_url( 'css/color-schemes/seaweed/colors.min.css' ),
     2130                array( '#10585C', '#15757a', '#a8c274', '#e78229' ),
     2131                array( 'base' => '#e1f9fa', 'focus' => '#fff', 'current' => '#fff' )
     2132        );
     2133
     2134        wp_admin_css_color( 'fresh', _x( 'Default', 'admin color scheme' ),
     2135                admin_url( 'css/colors-fresh.min.css' ),
     2136                array( '#222', '#333', '#0074a2', '#2ea2cc' )
     2137        );
    21062138}
    21072139
    21082140/**