In this tutorial, we dive into the world of custom WordPress dashboard themes by showing you how to switch your WordPress dashboard to a sleek dark mode.
Whether you want to reduce eye strain or prefer the aesthetic, this video will guide you using a free code snippet from the link below.
<?php
function applyCustomStyles() {
echo '
<style>
/* Change link colour to white */
#wpbody-content a {
filter: invert(1) hue-rotate(180deg) saturate(10);
color: white !important;
}
/* Change link colour to yellow */
#wpbody-content a:hover {
filter: invert(1) hue-rotate(180deg) saturate(10);
color: red !important;
}
/* Styling for primary content area. */
.block-editor-page .editor-styles-wrapper {
color: lightgray;
background: #262626;
}
/* Base styling adjustments. */
.wp-admin {
background-color: #262626;
}
/* Image display corrections. */
.wp-admin #wpbody img {
filter: invert(1) hue-rotate(-180deg);
background: white;
}
/* Enhancements for hyperlink visuals. */
.block-editor-page .editor-styles-wrapper a {
filter: invert(0.85) hue-rotate(185deg);
}
/* Filter reset for specific editor sections. */
.block-editor-page #wpbody {
filter: unset;
}
/* Adjustments for the main body appearance. */
.wp-admin #wpbody {
filter: invert(0.85) hue-rotate(185deg);
}
/* Sidebar appearance customization. */
.block-editor-page .interface-interface-skeleton__sidebar,
.block-editor-page .interface-interface-skeleton__secondary-sidebar {
filter: invert(0.85) hue-rotate(185deg);
}
/* Configuration for top navigation bar. */
.block-editor-page .interface-interface-skeleton__header {
filter: invert(0.85) hue-rotate(185deg);
}
/* Primary action button styling. */
.block-editor-page .is-primary {
color: black !important;
}
/* Lower section layout adjustments. */
.block-editor-page .edit-post-layout__metaboxes {
border-top: 0px;
background-color: #262626;
}
/* Reset various button BG colours */
.wrap .add-new-h2, .wrap .add-new-h2:active, .wrap .page-title-action, .wrap .page-title-action:active {
background:#f6f7f700;
}
</style>';
}
add_action('admin_head', 'applyCustomStyles');
What You Will Learn:
– How to change your WordPress dashboard to dark mode.
– Customizing hover colours and other elements within the dashboard.
– Using admin colour schemes to complement the dark mode.
– Implementing the dark mode using a PHP code snippet with a plugin like Fluent Snippets.
– Understanding the CSS properties such as ‘filter’, ‘invert’, and ‘hue-rotate’ to customize colours.
– How to modify links and text colours to fit your preferences.
Before You Start:
This is not a perfect solution but a starting point for those who want to experiment and tweak their WordPress dashboard’s appearance. Remember to choose an admin colour scheme that suits the dark mode from your user profile settings.
Step-by-Step Guide:
1. Install a code snippet plugin like Fluent Snippets (free) or any other that allows custom PHP code to be added.
2. Use the provided PHP code snippet to create a custom function and add it to the admin area of WordPress.
3. Customize the CSS within the snippet to change the look of your dashboard, including links, text, and background colours.
Key Points:
– The code snippet only affects the admin area and won’t change your website’s front end.
– The CSS ‘invert’ property creates the dark mode effect, with adjustments made for certain elements to maintain readability.
– You can fully customize the CSS to your liking, including the colours of links and hover effects.
Final Thoughts:
Have fun with this tutorial, and feel free to modify the code to suit your own style. If you run into any issues, you can easily disable the code snippet to revert any changes.
If you make any cool modifications or have suggestions, please share them in the comments section below. Let’s see how creative you can get with your WordPress dashboard!