Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin Color Schemes: generate wp-admin color schemes from Calypso counterparts #17828

Merged
merged 34 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
994b7d6
Admin Color Schemes: generate wp-admin color schemes from Calypso cou…
frontdevde Nov 17, 2020
1209878
Add Aquatic scaffolding
frontdevde Nov 18, 2020
1de16b1
Add Classic Blue scaffolding
frontdevde Nov 18, 2020
b8bb6d6
Add Classic Dark scaffolding
frontdevde Nov 18, 2020
1a9e687
Add Contrast scaffolding
frontdevde Nov 18, 2020
fb74df0
Add Nightfall scaffolding
frontdevde Nov 18, 2020
a9303c4
Add Powder Snow scaffolding
frontdevde Nov 18, 2020
f6c6897
Add Sakura scaffolding
frontdevde Nov 18, 2020
63a23b8
Add Sunset scaffolding
frontdevde Nov 18, 2020
a00e462
Prevent multiple rtl files in build output
frontdevde Nov 19, 2020
5863641
Refine Aquatic color scheme
frontdevde Nov 19, 2020
261c634
Add admin scheme overrides to match Calypso
frontdevde Nov 24, 2020
e312e8a
Add override for main nav background color to be different from sidebar
frontdevde Nov 24, 2020
289c91e
Use minified css
frontdevde Nov 24, 2020
bd825a2
wp-admin jQuery expects non-min path
frontdevde Nov 24, 2020
e827f7c
Refine Classic Blue color scheme
frontdevde Nov 24, 2020
98cf25d
Refine Classic Bright color scheme
frontdevde Nov 25, 2020
ab3bae0
Refine Classic Dark color scheme
frontdevde Nov 25, 2020
3880618
Refine Contrast color scheme
frontdevde Nov 25, 2020
b239fea
Refine Nightfall color scheme
frontdevde Nov 25, 2020
a81ac56
Refine Powder Snow color scheme
frontdevde Nov 25, 2020
ca2a75d
Refine Sakura color scheme
frontdevde Nov 26, 2020
17665ac
Refine Sunset color scheme
frontdevde Nov 26, 2020
d7b7bca
Iterate on Aquatic color scheme
frontdevde Nov 26, 2020
9405385
Iterate on Classic Blue color scheme
frontdevde Nov 26, 2020
c3c19e5
Iterate on Classic Bright color scheme
frontdevde Nov 26, 2020
d762ebb
Change Classic Dark icon hover color
frontdevde Nov 26, 2020
84060ab
Increase specificity to ensure #wpadminbar override
frontdevde Nov 26, 2020
d1e6498
Remove RTL build
frontdevde Dec 7, 2020
ffb15b9
Build to _inc directory
frontdevde Dec 8, 2020
56955dc
Add build-color-schemes task to package.json
frontdevde Dec 8, 2020
3810ba6
Remove gitignore addition after build target change
frontdevde Dec 9, 2020
4f81208
Account for different paths on wpcom
frontdevde Dec 9, 2020
9272275
Remove gulp variation in favor of Compass on wpcom
frontdevde Dec 10, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions modules/masterbar/admin-color-schemes/class-admin-color-schemes.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Admin_Color_Schemes {
* Admin_Color_Schemes constructor.
*/
public function __construct() {
add_action( 'admin_init', array( $this, 'register_admin_color_schemes' ) );
add_action( 'rest_api_init', array( $this, 'register_admin_color_meta' ) );
}

Expand Down Expand Up @@ -49,4 +50,133 @@ public function register_admin_color_meta() {
public function update_admin_color_permissions_check( $allowed, $meta_key, $object_id ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter, VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
return current_user_can( 'edit_user', $object_id );
}

/**
* Get the admin color scheme URL based on the environment
*
* @param string $color_scheme The color scheme to get the URL for.
* @return string
*/
public function get_admin_color_scheme_url( $color_scheme ) {
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
return plugins_url( 'colors/' . $color_scheme . '/colors.css', __FILE__ );
} else {
return plugins_url( '_inc/build/masterbar/admin-color-schemes/colors/' . $color_scheme . '/colors.css', JETPACK__PLUGIN_FILE );
}
}

/**
* Registers new admin color schemes
*/
public function register_admin_color_schemes() {

wp_admin_css_color(
'aquatic',
__( 'Aquatic', 'jetpack' ),
$this->get_admin_color_scheme_url( 'aquatic' ),
array( '#135e96', '#007e65', '#043959', '#c5d9ed' ),
array(
'base' => '#c5d9ed',
'focus' => '#fff',
'current' => '#01263a',
)
);

wp_admin_css_color(
'classic-blue',
__( 'Classic Blue', 'jetpack' ),
$this->get_admin_color_scheme_url( 'classic-blue' ),
array( '#135e96', '#b26200', '#dcdcde', '#646970' ),
array(
'base' => '#646970',
'focus' => '#2271b1',
'current' => '#fff',
)
);

wp_admin_css_color(
'classic-bright',
__( 'Classic Bright', 'jetpack' ),
$this->get_admin_color_scheme_url( 'classic-bright' ),
array( '#135e96', '#c9256e', '#ffffff', '#e9eff5' ),
array(
'base' => '#646970',
'focus' => '#1d2327',
'current' => '#0a4b78',
)
);

wp_admin_css_color(
'classic-dark',
__( 'Classic Dark', 'jetpack' ),
$this->get_admin_color_scheme_url( 'classic-dark' ),
array( '#101517', '#c9356e', '#32373c', '#0073aa' ),
array(
'base' => '#a2aab2',
'focus' => '#00b9eb',
'current' => '#fff',
)
);

wp_admin_css_color(
'contrast',
__( 'Contrast', 'jetpack' ),
$this->get_admin_color_scheme_url( 'contrast' ),
array( '#101517', '#ffffff', '#32373c', '#b4b9be' ),
array(
'base' => '#1d2327',
'focus' => '#fff',
'current' => '#fff',
)
);

wp_admin_css_color(
'nightfall',
__( 'Nightfall', 'jetpack' ),
$this->get_admin_color_scheme_url( 'nightfall' ),
array( '#00131c', '#043959', '#2271b1', '#9ec2e6' ),
array(
'base' => '#9ec2e6',
'focus' => '#fff',
'current' => '#fff',
)
);

wp_admin_css_color(
'powder-snow',
__( 'Powder Snow', 'jetpack' ),
$this->get_admin_color_scheme_url( 'powder-snow' ),
array( '#101517', '#2271b1', '#dcdcde', '#646970' ),
array(
'base' => '#646970',
'focus' => '#135e96',
'current' => '#fff',
)
);

wp_admin_css_color(
'sakura',
__( 'Sakura', 'jetpack' ),
$this->get_admin_color_scheme_url( 'sakura' ),
array( '#005042', '#f2ceda', '#2271b1', '#8c1749' ),
array(
'base' => '#8c1749',
'focus' => '#4f092a',
'current' => '#fff',
)
);

wp_admin_css_color(
'sunset',
__( 'Sunset', 'jetpack' ),
$this->get_admin_color_scheme_url( 'sunset' ),
array( '#691c1c', '#b26200', '#f0c930', '#facfd2' ),
array(
'base' => '#facfd2',
'focus' => '#fff',
'current' => '#4f3500',
)
);

}
}
Loading