• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • About
  • Subscribe
  • ☕ Support
  • ✉ Contact
    • Contact Me
    • Request Product Review
    • Work With Me
    • Submit Guest Post
  • Blog Archives
Nutty Hiker Adventures Logo

Nutty Hiker Adventures

Hike Every Hike Like It Is Your Last

GearTrade Banner
  • Hiking >>
    • Hiking Articles
    • Hiking 101 >
      • 10 Essentials of Hiking
      • Types of Hikes
      • Trail Etiquette
      • Hiking Terms & Jargon
      • Hiking First Aid Kit
      • What to Bring On Every Hike
      • Pre Thru-Hike Checklist
      • Hacks to Lighten Your Backpack Weight
      • How to Avoid Norovirus While Backpacking
      • Choosing a Sleeping Bag Liner
      • How to Poop in the Woods
      • Gift Guide for Hikers
      • Books for Hikers & Backpackers
      • Movies About Hiking
      • Subscription Boxes for Hikers
      • Thru-Hiking Trails Bucket List – USA Edition
      • Your Hiking Questions Answered
    • Long Trails >
      • Appalachian Trail
      • BamatoBaxter
      • Greenbrier River Trail
      • Lone Star Hiking Trail
      • Pinhoti Trail
    • Rails To Trails >
      • Greenbrier River Trail
    • Gear Reviews
    • Ask Nutty Hiker
  • Camping >>
    • Camping Articles
    • Camping Gear Reviews
  • Survival >>
    • Survival Articles
    • Survival Gear Reviews
  • Destinations >>
    • The Ultimate Road Trip Checklist || Adventure Safely
    • State Highpoints
    • National Parks & Forests >
      • Black Hills National Forest
      • Guadalupe Mountains National Park
    • Arizona
    • Arkansas
    • Colorado
    • Idaho
    • Kansas
    • Kentucky
    • Louisiana
    • Maryland
    • Nevada
    • New Mexico
    • North Dakota
    • Pennsylvania
    • South Dakota
      • Black Hills National Forest
    • Tennessee
    • Texas
      • North Texas
      • Central Texas
        • San Antonio
      • East Texas
      • South Texas
      • West Texas
      • Texas State Parks
      • Guadalupe Mountains National Park
    • Utah
    • Washington
    • West Virginia
  • Road Trips >>
    • The Ultimate Road Trip Checklist || Adventure Safely
    • Road Trip Ideas
  • Motorcycle >>
    • Sturgis 2024
  • News >>
    • Outdoor News
    • Interviews
  • Video’s
  • Photography >>
    • Latest Work
    • Photography Gear Reviews
    • Portrait Portfolio
  • ✎ Logbook >>
    • My Daily Antics
    • Ask Nutty Hiker
  • Resources >>
    • Recommendations
    • The Ultimate Road Trip Checklist || Adventure Safely
    • Hiking Essentials Checklist
    • Morse Code Converter || Send a Message in Morse Code
    • Military Time Converter
    • Message Encryption & Decryption
    • Message Transformer
  • Shop
    • My Artwork
    • Merch Store (T-Shirts & More)
You are here: Home / The Logbook / How to Add Custom Colors to the Color Palette in Gutenberg

How to Add Custom Colors to the Color Palette in Gutenberg

November 20, 2019 by Nutty Hiker Last Modified: July 20, 2020Leave a Comment

You may have noticed in Gutenberg (WordPress) you have the ability to choose a color from the color palette for the background or text color of the block you are working on under color settings on the right-hand side.

You will see predefined colors and an option (if your theme allows the ability) to pick a custom color from the color palette like below:

Color palette in Gutenberg WordPress

Wouldn’t it be cool if you could have your custom colors already predefined instead of using the predefined colors that come with your theme without using a plugin?

Well, you can, and it is as simple as editing the functions.php file (I suggest creating a child theme so that way if your main theme updates it will not override these edits) and adding some css to the custom css section.

Adding Custom Colors to the Color Palette

Step 1

Go to Appearance >> Theme Editor >> functions.php

Add the following:

// Adds support for editor color palette.
add_theme_support( 'editor-color-palette', array(
	array(
		'name'  => __( 'Light gray', 'themename' ),
		'slug'  => 'light-gray',
		'color'	=> '#f5f5f5',
	),
	array(
		'name'  => __( 'Medium gray', 'themename' ),
		'slug'  => 'medium-gray',
		'color' => '#999',
	),
	array(
		'name'  => __( 'Dark gray', 'themename' ),
		'slug'  => 'dark-gray',
		'color' => '#333',
       ),
) );

You will notice code above adds a light gray, medium gray, and dark gray color. You can add more colors by repeating the following before the ) ); at the end.

array(
		'name'  => __( 'Dark gray', 'themename' ),
		'slug'  => 'dark-gray',
		'color' => '#333',
       ),

Make sure to change ‘themename’ to the name of your theme. You can usually scroll up in the functions file and find the name of the theme.

Name = This is what you will see when you scroll over the color in the editor

Slug = This needs to be a unique name

Color = Here you will put the hex color (you can find hex color values here)

Step 2 – Add the CSS

Go to Appearance >> Edit Css

Add the following:

/** CUSTOM COLOR PALETTE **/
.has-ColorNameHere-color {
    color: #f5f5f5;
}

You will need to add the following for EACH color

.has-ColorNameHere-color {
color: #f5f5f5;
}

Make sure to replace ColorNameHere with the slug of the color in your functions.php file and replace the #f5f5f5 with your color hex number that corresponds to that color slug.

Example functions.php code:

// Adds support for editor color palette.
add_theme_support( 'editor-color-palette', array(
	array(
		'name'  => __( 'Light gray', 'mytheme' ),
		'slug'  => 'light-gray',
		'color'	=> '#f5f5f5',
	),
	array(
		'name'  => __( 'Medium gray', 'mytheme' ),
		'slug'  => 'medium-gray',
		'color' => '#999',
	),
	array(
		'name'  => __( 'Dark gray', 'mytheme' ),
		'slug'  => 'dark-gray',
		'color' => '#333',
       ),
) );

Example of the corresponding CSS for the Css file:

/** CUSTOM COLOR PALETTE **/
.has-light-gray-color {
    color: #f5f5f5;
}
.has-medium-gray-color {
    color: #999;
}
.has-dark-gray-color {
    color: #333;
}

Disclaimer: This post is for informational / educational purposes only. Opinions expressed in this post are not intended to provide specific financial, legal, or medical advice / recommendation. Bridget is not a lawyer, financial advsior, medical professional, therapist, astronomer or palm reader. You use this information in this post and elsewhere on the site at your own risk. This information on this site should not be taken as any type of professional advice. You should always consult a professional for any kind of legal, medical, or financial advice.

Filed Under: The Logbook

Reader Interactions

Leave a Comment or Suggestion Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

NEXT ADVENTURE BEGINS

BAMATOBAXTER
Currently on Trail as of April 3rd. We have started the Appalachian Trail portion of our BamaToBaxter Hike. Follow my journey on YouTube.

LATEST FROM THE TRAIL

Pinhoti Trail Day 29: Oakey Mountain

February 5, 2025 0

Recent Posts

  • Appalachian Trail: Pre-Trail Gear Changes
  • Pinhoti Trail Day 29: Oakey Mountain
  • Pinhoti Trail Day 28: Dugger Mountain & Plane Wreckage
  • Pinhoti Trail Day 26 & 27: Laurel Shelter to Burns Trailhead & a Zero Day
  • Pinhoti Trail Day 25: Pine Glen Campground to Laurel Shelter (& a Ghostly Tale)

Virtual Trail Angel

This blog is my full-time job. I rely heavily on support from my readers, whether it be from simply sharing my blog posts with their friends or through virtual trail magic (donations). If you want to help offset the cost of running this blog and support me while I am on trail or off on an adventure, you can do so through PayPal, CashApp, or Venmo.

PayPal
Cash App
Venmo

LATEST ADVENTURE

Sturgis 2024 Motorcycle

Sturgis 2024 Day 15-17: The Ride Home

September 25, 2024 0
Think Outside Subscription Banner
Zero Balance Banner
FarOut Guide Banner
Battlebox Banner

Footer

FOLLOW

  • Facebook
  • Instagram
  • YouTube
  • RSS Feed
  • Amazon
  • Patreon

SUPPORT =)

This blog is my full-time job. I rely heavily on support from my readers. If you would like to help offset the cost of running this blog and my nutty adventures so I can continue to bring you travel & outdoor adventures, please feel free to donate =)
Donate to Nutty Hiker

DISCLOSURE

Per the FTC, This website contains affiliate links, advertisements, and sponsored posts. For reviews, I was provided with a complimentary copy of the item unless otherwise stated. As an Amazon Associate, I earn from qualifying purchases using the amazon links located on my website. Read my full policy here.

AWARDS/ASSOCIATIONS

OWAA Member Logo Best Outdoor Blogs Best Hiking Blogs

Copyright © 2025 — Nutty Hiker Advenures | Bridget Carlson • All rights reserved.
The links on this website are solely for the convenience of our visitors. Nutty Hiker does not endorse, operate, or control external websites.
Terms of Use • Privacy Policy• Disclosure• Contest Rules