- This topic has 18 replies, 3 voices, and was last updated 3 years, 3 months ago by
Leo.
-
AuthorPosts
-
January 10, 2023 at 12:55 pm #2490639
sparkle
if i put this in my customizer, the colors change on the page, but not in the customizer circles.
:root {
–contrast: #09283D;
–contrast-2: #025547;
–contrast-3: #a9d4cd;
–base: #f0f0f0;
–base-2: #1A878E;
–base-3: #81fce7;
–accent: #DC3BA1;
}if i put it in my child theme, neither change, even if i add !important. why not? any way to have it all? there used to be function that no longer seems to work that set custom default colors and the customizer reflected the changes.
// change gp color palette add_filter( 'generate_default_color_palettes', 'tu_custom_color_palettes' ); function tu_custom_color_palettes( $palettes ) { $palettes = array( '#351C4D', /* brand */ '#FEBF7B', /* accent */ '#FF7E5F', /* action */ '#765285', /* hover */ '#C1c1c1', /* light */ '#fe7b84', /* midtone */ '#000000', /* black */ '#FFFFFF', /* white */ ); return $palettes; }January 11, 2023 at 8:18 am #2491623David
StaffCustomer SupportHi there,
see Toms reply here:
https://generatepress.com/forums/topic/changing-global-colors-programatically/#post-2122087
January 11, 2023 at 10:46 am #2491778sparkle
well, i did find and try that code, but for some reason it doesn’t work for me. subscriber credentials included below. let me know if you need more access to tell me what i did wrong. it’s the only thing in my functions file.
January 11, 2023 at 4:17 pm #2492118Leo
StaffCustomer SupportJust to confirm, are you using the new global colors system?
https://docs.generatepress.com/article/global-colors-overview/And can you try adding the code using Code Snippets plugin with the parent theme activated?
Let me know 🙂
January 12, 2023 at 7:31 am #2492819sparkle
yes, it’s a brand new install and i see the global colors system in my customizer.
i removed the code from my functions file, installed code snippets, added it, saved it, no change, activated it, no change. double checked parent theme vs child theme. weirdly i can see the new colors in the customizer now, but not on the pages. even with incognito.
then i gave your username admin access because i’m seriously confuzzled.
January 12, 2023 at 7:36 am #2492825sparkle
ok. with a little patience the cache on the front end let go and now i see the colors with the code snippet.
January 12, 2023 at 7:57 am #2493019sparkle
but why can’t i do anything with my child theme? rawr. i don’t want to use code snippets.
January 12, 2023 at 8:57 am #2493112David
StaffCustomer SupportCan you retry adding the code to the Child Theme functions.php ?
January 12, 2023 at 9:39 am #2493181sparkle
ok. it’s there now.
January 12, 2023 at 9:49 am #2493196sparkle
fyi, i have the child theme one set like this to see the difference.
add_filter( 'generate_option_defaults', function( $defaults ) { $defaults['global_colors'] = array( array( 'name' => __( 'Contrast', 'generatepress' ), 'slug' => 'contrast', 'color' => 'red',January 12, 2023 at 9:52 am #2493199sparkle
aaaand… i can see the red in the customizer but not the live site even if i deactivate code snippets (which i almost never use, will that disable it or not?
January 12, 2023 at 12:42 pm #2493372Leo
StaffCustomer SupportThe function here looks incomplete:
https://generatepress.com/forums/topic/customize-default-colors-via-css/#post-2493196Can you try the exact code here in the child theme?
https://generatepress.com/forums/topic/changing-global-colors-programatically/#post-2122087Please clear and disable all caching plugins and server caching for now.
January 12, 2023 at 12:46 pm #2493382sparkle
oh that was just the one part of it that i changed the color so it was different from the one in the code snippet plugin. it shows the titles red if it’s using the function.file. the full code in my child theme is this
//gp change color palette add_filter( 'generate_option_defaults', function( $defaults ) { $defaults['global_colors'] = array( array( 'name' => __( 'Contrast', 'generatepress' ), 'slug' => 'contrast', 'color' => 'red', ), array( /* translators: Contrast number */ 'name' => sprintf( __( 'Contrast %s', 'generatepress' ), '2' ), 'slug' => 'contrast-2', 'color' => '#025547', ), array( /* translators: Contrast number */ 'name' => sprintf( __( 'Contrast %s', 'generatepress' ), '3' ), 'slug' => 'contrast-3', 'color' => '#a9d4cd', ), array( 'name' => __( 'Base', 'generatepress' ), 'slug' => 'base', 'color' => '#f0f0f0', ), array( /* translators: Base number */ 'name' => sprintf( __( 'Base %s', 'generatepress' ), '2' ), 'slug' => 'base-2', 'color' => '#1A878E', ), array( /* translators: Base number */ 'name' => sprintf( __( 'Base %s', 'generatepress' ), '3' ), 'slug' => 'base-3', 'color' => '#81fce7', ), array( /* custom colors */ 'name' => __( 'Hot Pink', 'generatepress' ), 'slug' => 'sub-hot-pink', 'color' => '#BF047E', ), array( 'name' => __( 'Teal', 'generatepress' ), 'slug' => 'sub-teal', 'color' => '#32838C', ), array( 'name' => __( 'Aqua', 'generatepress' ), 'slug' => 'sub-aqua', 'color' => '#04BF9D', ), array( 'name' => __( 'Yellow', 'generatepress' ), 'slug' => 'sub-yellow', 'color' => '#DC3BA1', ), array( 'name' => __( 'Orange', 'generatepress' ), 'slug' => 'sub-orange', 'color' => '#D94423', ), ); return $defaults; } );January 13, 2023 at 9:37 am #2494508David
StaffCustomer SupportWhen you say you see it in the Customizer – is that just in the Global Color pallet?
If so, that is correct – that code only loads the default colors, you would need to then assign them where you require.January 13, 2023 at 10:17 am #2494544sparkle
ah… so an image is worth 1000 words here.
customizer shows functions file (red)
https://imgur.com/w7l0fjAlive view does not. even in incognito. var contrast stays black.
https://imgur.com/vUcej38does disabling code snippets plugin remove the snippets from use?
-
AuthorPosts
- You must be logged in to reply to this topic.