mkdocs-simple-blog icon indicating copy to clipboard operation
mkdocs-simple-blog copied to clipboard

FEATURE - Persist theme option in localstorage or cookie

Open brunoruas2 opened this issue 1 year ago • 1 comments

I think it would be a cool feature to persist the theme selection in local browser data, to pass this information to all pages, not just the current selection, as a default feature of mkdocks-simple-blog.

Where do you think is the most appropriate place to persist this information? LocalStorage or some cookie usage?

brunoruas2 avatar Dec 04 '23 02:12 brunoruas2

Interesting question @brunoruas2. So, analyzing it, I believe that localstorage should be the way to go, because it is the best way to persist this type of configuration compared to cookies.

For mkdocs-simple-blog there is already an option to configure the theme that will be rendered. This configuration is in the mkdocs.yml file, and you can change the theme type or colors separately.

Example:

theme:
  name: simple-blog
  favicon: assets/favicon.ico
  logo: assets/logo.png
  theme_style: light
  site_name_style: normal
  title_style: bold
  colors:
    text: black
    title: black
    primary: black
    background: white
  components:
    site_name: true
    title: true
    menu: true
    preview: true
    footer: true

2023-12-04_20-39

Links:

FernandoCelmer avatar Dec 04 '23 23:12 FernandoCelmer