- This topic has 15 replies, 4 voices, and was last updated 4 years ago by Tom.
-
AuthorPosts
-
April 16, 2020 at 7:44 am #1241463M
I am using GeneratePress for creation of a camera club website from an existing site created many years ago. The colour and structure will remain the same. The background colour of all screens is back with white text (#cccccc). In Edit page if the colours have been set though Customise, Colours, Content then the Edit Page is largely okay although the contrast is weaker than on the viewed display. My question is that Block separators are used between sections and should be coloured as the text but in Edit Page they are always nearly black and cannot be seen. How can this be changed?
April 16, 2020 at 3:36 pm #1242203TomLead DeveloperLead DeveloperHi there,
Any chance you can show us a screenshot of the issue? It may be something we need to tweak in the theme.
Let me know 🙂
April 17, 2020 at 3:34 am #1242644MI must confess I struggled with working out how to send you a screenshot of all things!! I have placed 2 images on Amazon “https://www.amazon.co.uk/photos/share/6oUBDejfG8s5V8hLZX51WIWrCPd2XApO0eO4RqFaIDz”
The first is in Edit Mode with actual screen colors set via Customise, Colours, Content with the separator selected and clearly not visible because its default color must be a dark one. This is the problem finding any separators while editing and not wanting to manually set them all. The secong shot is after customising the separator to #cccccc. I set the separator to be color #cccccc via additional css which works but this doesn’t show in edit mode and there isn’t a route via Customise, Colours, Content to set the color either. Hope this helpsApril 17, 2020 at 9:53 am #1243254TomLead DeveloperLead DeveloperAh, the Additional CSS isn’t added to the editor by default.
Try this:
add_action( 'enqueue_block_editor_assets', function() { $css = 'body .editor-styles-wrapper .wp-block-separator{border-bottom: 1px solid #cccccc;}'; wp_add_inline_style( 'generate-block-editor-styles', $css ); } );
Adding PHP: https://docs.generatepress.com/article/adding-php/
Let me know 🙂
April 17, 2020 at 11:05 am #1243340MThanks for the speedy reply. Sorry, where is the code to be included? For clarity my comment “via additional css” was for the site under Customize, Addional css.
April 17, 2020 at 11:11 am #1243344LeoStaffCustomer SupportTom’s code should be added using one of these methods:
https://docs.generatepress.com/article/adding-php/April 18, 2020 at 5:08 am #1244016MI have tried the methods suggested and none influence my problem in any way. Also I think there is a syntax eoor in the code supplied. I think there is a missing semicolon on line 2. Should it be:-
add_action( ‘enqueue_block_editor_assets’, function() {
$css = ‘.wp-block-separator{border-bottom: 1px solid #cccccc;}’;
wp_add_inline_style( ‘generate-block-editor-styles’, $css );
} );April 18, 2020 at 9:48 am #1244494TomLead DeveloperLead DeveloperAh, sorry about that! Fixed it here: https://generatepress.com/forums/topic/edit-page-colours/#post-1243254
April 18, 2020 at 11:36 am #1244580MThanks for your reply. I had tried the code with the correction I suggested and it had no impact on the block separator colors at all in Block Edit mode. I think I must be missing something.
April 18, 2020 at 5:28 pm #1244807TomLead DeveloperLead DeveloperCan you try the updated function?: https://generatepress.com/forums/topic/edit-page-colours/#post-1243254
April 19, 2020 at 4:00 am #1245103MI have tried the updated function and it still doesntset the separator colour to #cccccc in Block Editor. Thanks.
I was using:-
add_action( ‘enqueue_block_editor_assets’, function() {
$css = ‘body .editor-styles-wrapper .wp-block-separator{border-bottom: 1px solid #cccccc;}’;
wp_add_inline_style( ‘generate-block-editor-styles’, $css );
} );April 19, 2020 at 4:49 am #1245151DavidStaffCustomer SupportHi there,
try this for your CSS variable:
$css = 'body .block-editor-block-list__block hr{border-bottom: 1px solid #cccccc;}';
April 19, 2020 at 10:46 am #1245658MHi David
I believe I did what you suggesed and replaced the line in the most recent code that defines the $css variable as below:-
add_action( ‘enqueue_block_editor_assets’, function() {
$css = ‘body .block-editor-block-list__block hr{border-bottom: 1px solid #cccccc;}’;
wp_add_inline_style( ‘generate-block-editor-styles’, $css );
} );
This also didnt change the separator color in Block Edit mode.April 19, 2020 at 4:57 pm #1245950TomLead DeveloperLead DeveloperJust tested this one, it should do the trick:
add_action( 'enqueue_block_editor_assets', function() { $css = 'body .block-editor-block-list__block hr{background-color: #cccccc;}'; wp_add_inline_style( 'generate-block-editor-styles', $css ); }, 100 );
April 20, 2020 at 3:20 am #1246340MHi Tom
Yes that works just fine. Thanks so much. Although it is such a small change it will have a big impact on what I need to complete – documenting how to maintain the site!
Once again thanks for you patience and support.
Martin
-
AuthorPosts
- You must be logged in to reply to this topic.