Skip to content

Change Color in mkdocs theme #756

Closed
Closed

Description

@jeffpeiyt

Would be great to have some color options to change the theme of the default mkdocs.

seems it is stored in bootstrap-custom.min.css and it is hard to easiliy overwrite. Any one has some example of the "extra.css" that can share?

Thanks!

Activity

  1. d0ugal commented on Nov 20, 2015

    @d0ugal
    Contributor

    The only way to do this would be to add extra CSS as you described, I am not aware of any good examples. Otherwise we need to figure out a more general solution for this. See #607

  2. waylan commented on Nov 20, 2015

    @waylan
    Contributor

    While the theme customizations discussed in #607 may help, they are targeted at modifying the HTML output by MkDocs. This request appears to be about modifying the CSS. As this point, a user could copy the existing CSS file and then make the changes to fit their design/color scheme. I expect that if they put the CSS file in the custom theme dir and give it the same name, it will replace the built-in file.

    However, that it not very efficient. Just to change a couple colors will require replacing the same color in multiple locations throughout the CSS file. Of course, this is a solved problem with CSS pre-processors like {less} or Sass. I was recently playing the Reveal.js (a Markdown/HTML slideshow framework) and I thought they has a nice solution for quickly and easily creating your own theme just by overriding a few Sass variables.

    To be clear, I have not used {less} or Sass (or the various other pre-processors out there) except to dabble when working with a third party project that has chosen to use them. I have no formal opinion on which is better or if such a thing is really a good idea. I was just pleasantly surprised by how easy it was to consistently alter a couple colors to create my own variation on an existing theme. I would love to be able to replace the MkDocs blue just as easily.

    Note that both projects have Python ports of their compilers ({less} & Sass), so it should be easy enough to incorporate into MkDocs build process.

  3. d0ugal commented on Nov 20, 2015

    @d0ugal
    Contributor

    It is actually very easy to add to CSS and overwrite small sections, we actually do this in the MkDocs documentation. The CSS is automatically added below the theme in the HTML and this can overwrite any section. https://github.com/mkdocs/mkdocs/blob/master/docs/css/extra.css

  4. jeffpeiyt commented on Nov 20, 2015

    @jeffpeiyt
    Author

    thanks for the suggestion. ! Actually I just found this one that looks great: https://github.com/chrissimpkins/cinder and added support for >2 level nav.
    chrissimpkins/cinder#2

    Maybe we could add this template to the mkdocs default templates as a great option

  5. chrissimpkins commented on Nov 23, 2015

    @chrissimpkins

    PR by @jeffpeiyt was merged into the Cinder theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions