Giter VIP home page Giter VIP logo

doxygen-awesome-css's Introduction

Doxygen Awesome

GitHub release (latest by date) GitHub

Screenshot of Doxygen Awesome CSS

Doxygen Awesome is a custom CSS theme for doxygen html-documentation with lots of customization parameters.

Motivation

I really like how the doxygen html-documentation is structured! But IMHO it looks a bit outdated.

This theme is an attemt to update the visuals of doxygen without changing it's overall layout too much.

Features

  • ๐ŸŒˆ Clean, modern design
  • ๐Ÿš€ Heavily customizable by adjusting CSS-variables
  • ๐Ÿงฉ No changes to the HTML structure of Doxygen required
  • ๐Ÿ“ฑ Improved mobile usability
  • ๐ŸŒ˜ Dark mode support!
  • ๐Ÿฅ‡ Works best with doxygen 1.9.1

Installation

Copy the css files from this repository into your project or add this repository as submodule and check out the latest release:

git submodule add https://github.com/jothepro/doxygen-awesome-css.git
cd doxygen-awesome-css
git checkout v1.5.0

Then make the option HTML_EXTRA_STYLESHEET in your Doxyfile point to the css files:

# Doxyfile
# ...
HTML_EXTRA_STYLESHEET  = doxygen-awesome-css/doxygen-awesome.css

Variants

There is two variants of the theme.

theme variations

  1. Base theme:
# Doxyfile
GENERATE_TREEVIEW      = YES # optional. Also works without treeview
HTML_EXTRA_STYLESHEET  = doxygen-awesome-css/doxygen-awesome.css
  1. Sidebar-only theme (experimental):
# Doxyfile
GENERATE_TREEVIEW      = YES # required!
HTML_EXTRA_STYLESHEET  = doxygen-awesome-css/doxygen-awesome.css doxygen-awesome-css/doxygen-awesome-sidebar-only.css

Dark Mode Toggle (Experimental)

The theme comes with an experimental feature that adds a button to enable and disable the dark theme variant manually.

It requires customizations in both the header & footer html template.

  1. Create default header & footer templates:

    doxygen -w html header.html footer.html delete_me.css
  2. Reference the required resources in your Doxyfile:

    # Include the required Javascript
    HTML_EXTRA_FILES       = doxygen-awesome-css/doxygen-awesome-darkmode-toggle.js
    
    # Add the additional CSS. This is ONLY required for the sidebar-only theme variant!
    HTML_EXTRA_STYLESHEET  = doxygen-awesome-css/doxygen-awesome.css \ 
                             doxygen-awesome-css/doxygen-awesome-sidebar-only.css \
                             doxygen-awesome-css/doxygen-awesome-sidebar-only-darkmode-toggle.css
    
    # set custom header & footer files generated in previous step
    HTML_HEADER            = header.html
    HTML_FOOTER            = footer.html
    
  3. In header.html, include doxygen-awesome-darkmode-toggle.js at the end of the <head>:

    <html> 
        <head>
            <!-- ... other metadata & script includes ... -->
            <script type="text/javascript" src="$relpath^doxygen-awesome-darkmode-toggle.js"></script>
        </head>
        <body>
  4. In footer.html, initialize the doxygen-awesome-dark-mode-toggle element at the end of the <body>:

            <!-- ... -->
            <script type="text/javascript">
                $(document).ready(function(){
                    toggleButton = document.createElement('doxygen-awesome-dark-mode-toggle')
                    toggleButton.title = "Toggle Light/Dark Mode"
                    document.getElementById("MSearchBox").parentNode.appendChild(toggleButton)
                })
            </script>
        </body>
    </html>

Examples

Configuration

CSS Variables

This theme is highly customizable because a lot of things are parameterized with CSS variables. The following list of parameters is not complete! You can easily modify any variable with the developer tools of your browser to find out what it does.

To customize the existing theme, add your own custom.css and overwrite the variables there:

HTML_EXTRA_STYLESHEET  = doxygen-awesome-theme/doxygen-awesome.css custom.css
/* custom.css */
html {
    /* define light-mode variable overrides here */
}

@media (prefers-color-scheme: dark) {
    html:not(.light-mode) {
        /* define dark-mode variable overrides here if you DON'T use doxygen-awesome-darkmode-toggle.js */
    }
}

html.dark-mode {
    /* define dark-mode variable overrides here if you DO use doxygen-awesome-darkmode-toggle.js */
}
Parameter Default (Light) Default (Dark)
Color Scheme:
primary theme color. This will affect the entire websites color scheme: links, arrows, labels, ...
--primary-color #1779c4 #1982d2
--primary-dark-color #00559f #5ca8e2
--primary-light-color #7aabd6 #4779ac
--primary-lighter-color #cae1f1 #191e21
--primary-lightest-color #e9f1f8 #191a1c
Spacing:
default spacings. Most ui components reference these values for spacing, to provide uniform spacing on the page.
--spacing-small 5px
--spacing-medium 10px
--spacing-large 16px
Border Radius:
border radius for all rounded ui components. Will affect many components, like dropdowns, memitems, codeblocks, ...
--border-radius-small 4px
--border-radius-medium 6px
--border-radius-large 8px
Content Width:
The content is centered and constraint in it's width. To make the content fill the whole page, set the following variable to auto.
--content-maxwidth 1000px
Code Fragment Colors:
Color-Scheme of multiline codeblocks
--fragment-background #282c34
--fragment-foreground #fff
Arrow Opacity:
By default the arrows in the sidebar are only visible on hover. You can override this behaviour so they are visible all the time.
--side-nav-arrow-opacity 0
--side-nav-arrow-hover-opacity 0.9
Darkmode Toggle Icon:
If you have enabled the darkmode toggle button, you can define the icon that is shown for the current mode.
--darkmode-toggle-button-icon โ˜€๏ธ ๐ŸŒ›
...and many more

If you miss a configuration option or find a bug, please consider opening an issue!

Doxygen generator

The theme overrides most colors with the --primary-color-* variables.

But there is a few small images and graphics that the theme cannot adjust or replace. To make these blend in better with the rest, it is recommended to adjust the doxygen color settings to something that matches the chosen color-scheme.

For the default color-scheme, these values work out quite well:

# Doxyfile
HTML_COLORSTYLE_HUE    = 209
HTML_COLORSTYLE_SAT    = 255
HTML_COLORSTYLE_GAMMA  = 113

Browser support

Tested with

  • Chrome 91, Chrome 91 for Android, Chrome 87 for iOS
  • Safari 14, Safari for iOS 14
  • Firefox 89, Firefox Daylight 89 for Android, Firefox Daylight 33 for iOS

Tips & Tricks

Class Diagrams with Graphviz

To get the best looking class diagrams for your documentation, generate them with Graphviz as vector graphics with transparent background:

# Doxyfile
HAVE_DOT = YES
DOT_IMAGE_FORMAT = svg
DOT_TRANSPARENT = YES

Share your own theme customizations

If you customized the theme with custom colors, spacings, font-sizes, etc. and you want to share your creation with others, you can to this here.

I am always curious to learn about how you made the theme look even better!

Credits

This theme is heavily inspired by the beautiful vuepress static site generator default theme!

doxygen-awesome-css's People

Contributors

jothepro avatar nambers avatar r0ckarong avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.