In a discussion about CSS conflicts in the header, chrispine1991 shared a custom CSS snippet for styling the search banner text with a gradient, but noted it caused the search bar text to fade into the background. They later found a workaround by targeting a specific h1 class and asked how to locate the source file for the “Welcome to our community” text rendered under ember14. Don advised against editing core files and instead recommended creating a new theme component to override the CSS safely. Don provided step-by-step instructions to create a component, target h1 and p elements within .custom-search-banner-wrap, and apply the gradient styling without affecting the input field. He also reminded chrispine1991 to remove the previous conflicting CSS. chrispine1991 thanked Don, acknowledging the steep learning curve while porting from Flarum to Discourse.
I actually found a workaround but need help locating the source file.
So if I use the console to force a header class as seen below:
<h1 class="main-title-text">Welcome to our community</h1>
and then create the associated css:
.main-title-text {
background: -webkit-gradient(linear, left center, right bottom, from(#484848), to(#0097ff), to(#ffffff));
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
everthing seems to work. Now that I have figured out the workaround, how do I find the necessary file to edit under div “ember14” where the “Welcome to the community” text is rendered?
Is there a specific file, ie index.js?
(I am porting over from Flarum and new to this platform)
Thanks
I am not sure I fully understand but you can target the h1 and p in custom search so it won’t affect the input field.
You don’t need to change the specific source file. In these cases you can create a new theme component which will override the specific part of css code. But if you really want to change it than you have to fork the theme component GitHub - discourse/discourse-search-banner · GitHub and after fork you can change the template file.
But there is a much easier and maintainable method
Create a new component.
Go to /admin/customize/themes/
Customize → Themes
Click the Components tab and then the Install button
On the popup window click Create new button and type the new component name.
.custom-search-banner-wrap {
h1, p {
background: -webkit-gradient(linear, right top, left bottom, from(#eaf0ff), to(#0932a5), to(#060064));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
}
Click Save. Done!
And don’t forget to remove your previous code
.custom-search-banner-wrap {
// remove this part because we add this to the h1 and p
-webkit-text-fill-color: transparent;
background: -webkit-gradient(linear,right top, left bottom,from(#eaf0ff),to(#0932a5),to(#060064));
-webkit-background-clip: text;
}