jchue / argon-webtrees-theme

Argon theme for webtrees 2, the online genealogy application
16 stars 1 forks source link

FEATURE REQUEST: custom css #15

Closed JesseWebDotCom closed 2 years ago

JesseWebDotCom commented 2 years ago

To be able to customize this theme without touching the module files (ex. I want to change the icon for the individual silhouette), I'd like you to add the ability for a user defined custom.css file. I was able to get this working as follows:

  1. create resources/css/custom.css
  2. update module.php stylesheets function as follows:3.

    public function stylesheets(): array
    {
        // NOTE - a future version of webtrees will allow the modules to be stored in a private folder.
        // Only files in the /public/ folder will be accessible via the webserver.
        // Since modules cannot copy their files to the /public/ folder, they need to provide them via a callback.
        $stylesheets[] = $this->assetUrl('css/theme.css');
        $stylesheets[] = $this->assetUrl('css/custom.css');
        $stylesheets[] = $this->assetUrl('css/fontawesome.css');
    
        return $stylesheets;
    }

Then I just add my custom CSS to resources/css/custom.css

jchue commented 2 years ago

webtrees 2.0 and 2.1 support custom CSS/JS by default:

Screen Shot 2022-08-17 at 7 50 59 PM

Alternatively, if you want to use an entirely separate CSS file, you can use https://github.com/makitso/custom-css.