Skip to content

Commit

Permalink
feat: add custom colors
Browse files Browse the repository at this point in the history
  • Loading branch information
ludiofs committed Oct 24, 2023
1 parent 805516e commit 46b748f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
28 changes: 28 additions & 0 deletions inc/divi-color-palette.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

if (!defined('ABSPATH')) {
return;
}

add_action('wp_head', function() {
$divi_colors = get_option('et_divi');

if (!$divi_colors) {
return;
}

$colors = $divi_colors["divi_color_palette"];

$colors = explode("|", $colors);
$css = ":root {";
foreach ($colors as $key => $color) {
$color_key = $key + 1;
$css .= "--wp-preset-divi-color-$color_key: $color;";
}

$css .= "}";

echo "<style>";
echo $css;
echo "</style>";
});
1 change: 1 addition & 0 deletions src/scss/_custom.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// custom css here
10 changes: 6 additions & 4 deletions src/scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@

$black: #000;
$white: #fff;
$primary: #32a709;
$secondary: #daf238;
$tertiary: #e4debe;
$primary: var(--wp-preset-divi-color-1);
$secondary: var(--wp-preset-divi-color-2);
$tertiary: var(--wp-preset-divi-color-3);
$quaternary: var(--wp-preset-divi-color-4);

$colors: (
"black": $black,
"white": $white,
"primary": $primary,
"secondary": $secondary,
"tertiary": $tertiary
"tertiary": $tertiary,
"quaternary": $quaternary
);

:root {
Expand Down
1 change: 1 addition & 0 deletions src/scss/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@import 'background';
@import 'typography';
@import 'header';
@import 'custom';


/* Fullwidth section and row styles */
Expand Down

0 comments on commit 46b748f

Please sign in to comment.