Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Themes & Styling

Change Quark Background Color

first-time theme

Solved by pamtbaau View solution

Started by David Garner 5 years ago · 7 replies · 2020 views
5 years ago

Sorry, first time Grav user here. I am trying to change the background color of my custom/inherited Quark theme (I just copied the theme and renamed so I could customize).

I am having trouble changing the background color using custom.css. I've tried using selectors for body, #start, #page-wrapper, #top....really everything that I can find when I view and inspect.

When the DOM loads, I can see the my desired background color, but as the page populates, the normal Quark "white" is placed over it.

I've even tried editing the _base.scss file to properly display a different color, but no dice.

If anyone has had any luck changing the background color, or can point me to the file that is populating the other white color, it would be greatly appreciated. Thank you!

👍 1
5 years ago

@logjammin, When performing the following steps, all seems to be working well...

  • Fresh install of Grav 1.7.18
  • Install plugin 'devtools': $ bin/gpm install devtools
  • Create inherited theme using $ bin/plugin devtools new-theme
  • Tell Grav to use the new inherited theme in '/user/config/system.yaml'
    YAML
    pages:
    theme: mytheme
    
  • Create file '/user/themes/mytheme/css/custom.css' with:
    CSS
    body {
      background: red;
    }
    
  • Open the site in the browser and enjoy the red background.
5 years ago

Ah, okay!

I'll try a fresh install and follow those steps. I'll let you know if it works.

Thanks much!

5 years ago

So I tried the fresh install and creating the inherited theme with the devtools, but the background is still white after the page gets done loading. I can see the red, at the start, but it's almost as if when the modular piece is loaded into the DOM, it covers the background up.

5 years ago

Hmmm, I think I found the issue in my base.html.twig

If I remove line 21

TWIG
    {% do assets.addCss('theme://css-compiled/spectre'~compress) %}

it certainly throws the styling off for the whole page, but the background is now visible. So I guess I just need to find where the background is being overridden in the spectre files....

Which seems weird, since I no longer have those files in the new project.

5 years ago Solution

@logjammin, Just noticed that you are using a modular page...

To summarise the issue on Github, the main cause of the problem is !important in the following snippet in 'spectre.min.css':

CSS
.bg-gray {
    background: #f8f9fa !important;
}

Since the suggested solution has not yet been accepted, one can override the background using the following in 'custom.css' in your inheriting theme:

CSS
.bg-gray {
    background: red !important;
}
👍 1
last edited 08/11/21 by pamtbaau
5 years ago

Thanks! I'll mark yours as the solution since it's much easier.

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by Pedro M, 2 months ago
4 202 2 months ago
Themes & Styling · by Ian, 2 months ago
3 98 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 461 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 52 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 132 3 months ago