# How to get Accent Color variable

**URL:** <https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193>\
**Category:** BB Theme\
**Created:** [May 13, 2015, 10:53am UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193 "2015-05-13T10:53:23Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![wet-hat](https://community.wpbeaverbuilder.com/user_avatar/community.wpbeaverbuilder.com/wet-hat/32/251_2.png) [@wet-hat](https://community.wpbeaverbuilder.com/u/wet-hat)\
**Post date:** [May 13, 2015, 10:53am UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193/1 "2015-05-13T10:53:23Z")

</div>

I’d like to use the accent color in other parts of my child theme. What’s the best way to do that? Is it a simple CSS class? Or do I need to access it via PHP? In the latter case, what’s you preferred convention for doing so?

Thanks!

---

<div class="post-metadata">

**Author:** ![bencarlo](https://community.wpbeaverbuilder.com/user_avatar/community.wpbeaverbuilder.com/bencarlo/32/287_2.png) [@bencarlo](https://community.wpbeaverbuilder.com/u/bencarlo)\
**Post date:** [May 13, 2015, 11:02am UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193/2 "2015-05-13T11:02:32Z")

</div>

Hey Skyler,

Thanks for getting in touch! The only way to style all the other elements in your site would be via custom CSS.

Ben

---

<div class="post-metadata">

**Author:** ![wet-hat](https://community.wpbeaverbuilder.com/user_avatar/community.wpbeaverbuilder.com/wet-hat/32/251_2.png) [@wet-hat](https://community.wpbeaverbuilder.com/u/wet-hat)\
**Post date:** [May 13, 2015, 11:08am UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193/3 "2015-05-13T11:08:26Z")

</div>

That’s fine, but is there a way for me to at least access the color and put it in a PHP variable?

---

<div class="post-metadata">

**Author:** ![wet-hat](https://community.wpbeaverbuilder.com/user_avatar/community.wpbeaverbuilder.com/wet-hat/32/251_2.png) [@wet-hat](https://community.wpbeaverbuilder.com/u/wet-hat)\
**Post date:** [May 13, 2015, 11:08am UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193/4 "2015-05-13T11:08:58Z")

</div>

Thanks for your reply by the way 🙂

---

<div class="post-metadata">

**Author:** ![justin](https://community.wpbeaverbuilder.com/user_avatar/community.wpbeaverbuilder.com/justin/32/16_2.png) [@justin](https://community.wpbeaverbuilder.com/u/justin)\
**Post date:** [May 14, 2015, 11:11am UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193/5 "2015-05-14T11:11:03Z")

</div>

Hi Skyler,

All of the settings are stored in the database as [theme mods](https://codex.wordpress.org/Function_Reference/get_theme_mod). You can access the accent color (or any setting for that matter) by using…

`$mod = get_theme_mod( 'fl-accent' );`

Let me know if you have any questions about that.

Justin

---

<div class="post-metadata">

**Author:** ![cdivas](https://community.wpbeaverbuilder.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@cdivas](https://community.wpbeaverbuilder.com/u/cdivas)\
**Post date:** [June 10, 2015, 3:44pm UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193/6 "2015-06-10T15:44:30Z")

</div>

Hello guys!

I am trying to accomplish the same thing here. I am interested in having some custom CSS that uses the accent color.

With this approach, Do I need to create a PHP file and use it as a CSS? I am not to savvy of this stuff :S

Thank you!

---

<div class="post-metadata">

**Author:** ![wet-hat](https://community.wpbeaverbuilder.com/user_avatar/community.wpbeaverbuilder.com/wet-hat/32/251_2.png) [@wet-hat](https://community.wpbeaverbuilder.com/u/wet-hat)\
**Post date:** [June 10, 2015, 4:07pm UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193/7 "2015-06-10T16:07:21Z")

</div>

I used some styles in the header to create a class for the accent color, which I could then apply to the necessary elements throughout the body of the site. There are more elegant solutions, but it’s a great stop gap for now.

---

<div class="post-metadata">

**Author:** ![cdivas](https://community.wpbeaverbuilder.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@cdivas](https://community.wpbeaverbuilder.com/u/cdivas)\
**Post date:** [June 10, 2015, 4:21pm UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193/8 "2015-06-10T16:21:41Z")

</div>

Hello Skyler!

Thank you for your reply! This sounds good. Are you using a Child Theme?

I am trying to figure out how to add this to the header without loosing the header options or loosing the chagned when updating.

Thank you!

---

<div class="post-metadata">

**Author:** ![justin](https://community.wpbeaverbuilder.com/user_avatar/community.wpbeaverbuilder.com/justin/32/16_2.png) [@justin](https://community.wpbeaverbuilder.com/u/justin)\
**Post date:** [June 11, 2015, 8:56am UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193/9 "2015-06-11T08:56:53Z")

</div>

Hey Carlos,

Yes, you’ll need to use a child theme to accomplish this. Here’s an example of what you can add to your child theme’s functions.php file (untested)…

```auto
<?php
    
function my_custom_css()
{
    $accent = get_theme_mod( 'fl-accent' );
    
    ?>
    <style>
    
    .my-css-class {
        color: <?php echo $accent; ?>
    }
            
    </style>
    <?php
}

add_action( 'wp_head', 'my_custom_css' );

```

Justin

---

<div class="post-metadata">

**Author:** ![wet-hat](https://community.wpbeaverbuilder.com/user_avatar/community.wpbeaverbuilder.com/wet-hat/32/251_2.png) [@wet-hat](https://community.wpbeaverbuilder.com/u/wet-hat)\
**Post date:** [June 11, 2015, 11:07am UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193/10 "2015-06-11T11:07:10Z")

</div>

What Justin said is exactly what I did. Next time I’ll post my code too 🙂

I actually _always_ use a child theme, so that I can make modifications later without erasing current theme settings. It’s kind of like, “why not?”.

---

<div class="post-metadata">

**Author:** ![justin](https://community.wpbeaverbuilder.com/user_avatar/community.wpbeaverbuilder.com/justin/32/16_2.png) [@justin](https://community.wpbeaverbuilder.com/u/justin)\
**Post date:** [June 11, 2015, 1:12pm UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193/11 "2015-06-11T13:12:14Z")

</div>

Awesome! Don’t be shy, we love when people share their code 😉

Justin

---

<div class="post-metadata">

**Author:** ![cdivas](https://community.wpbeaverbuilder.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@cdivas](https://community.wpbeaverbuilder.com/u/cdivas)\
**Post date:** [June 11, 2015, 1:13pm UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193/12 "2015-06-11T13:13:21Z")

</div>

Hello Guys!

Thank you for your help. It is working nicely.

---

<div class="post-metadata">

**Author:** ![cdivas](https://community.wpbeaverbuilder.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@cdivas](https://community.wpbeaverbuilder.com/u/cdivas)\
**Post date:** [June 16, 2015, 5:02pm UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193/13 "2015-06-16T17:02:21Z")

</div>

Hello!

I am back.

I already tried the code and it working great for ‘fl-accent’. However, I tried using the same code with ‘fl-body-text-color’ with no luck. I shows as if thet field was empty, but it is not.

Here is a copy of my code:

```auto
function wr_custom_css()
{
    $accent = get_theme_mod( 'fl-accent' );
    $colordecontenido = get_theme_mod( 'fl-body-text-color' );
    
    ?>
    <style>
    
    .wr-bg-accent {
        background-color: <?php echo $accent; ?>
    }
    
    .wr-border-accent .fl-col-content {
    	border-color: <?php echo $accent; ?> !important
    }
    
    .wr-content-accent, .wr-h3-accent h3 {
    	color: <?php echo $accent; ?>
    }
    
    .contact-callout-row h3 {
    	color: <?php echo $colordecontenido; ?>
    }
    
    .contact-callout-row .fl-icon i {
    	background-color: <?php echo $accent; ?>;
    	color:white;
        line-height: 52.5px;
        height: 52.5px !important;
        width: 52.5px !important;
        text-align: center;
    }
            
    </style>
    <?php
}

add_action( 'wp_head', 'wr_custom_css' );

```

Please advice.

Thank you!

---

<div class="post-metadata">

**Author:** ![bencarlo](https://community.wpbeaverbuilder.com/user_avatar/community.wpbeaverbuilder.com/bencarlo/32/287_2.png) [@bencarlo](https://community.wpbeaverbuilder.com/u/bencarlo)\
**Post date:** [June 17, 2015, 4:28am UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193/14 "2015-06-17T04:28:49Z")

</div>

Hey Carlos,

I just tried using your function on my local dev and it works just fine. Changing the Text Color under General \> Text changes the color of text on modules having the class name.

Ben

---

<div class="post-metadata">

**Author:** ![system](https://community.wpbeaverbuilder.com/uploads/default/original/2X/9/9db1b183a7ea1efa26199a2a2b3511d742473dae.png) [@system](https://community.wpbeaverbuilder.com/u/system)\
**Post date:** [April 27, 2019, 10:16pm UTC](https://community.wpbeaverbuilder.com/t/how-to-get-accent-color-variable/3193/15 "2019-04-27T22:16:31Z")

</div>

Closed on April 27, 2019, 10:16pm UTC


