dotnet / docfx

Static site generator for .NET API documentation.
https://dotnet.github.io/docfx/
MIT License
4.04k stars 860 forks source link

Add A toggle switch Theme #8304

Closed JM2K69 closed 1 year ago

JM2K69 commented 1 year ago

It would be nice to switch over Theme mode Dark or Light with a toggle or combobox. For the default Theme docfx-v3

ghost commented 1 year ago

@JM2K69 If you add the darkfx theme as a template, then you get this for free:

Install the theme as per the instructions at https://github.com/steffen-wilke/darkfx.

Put the following in your docfx.json:

    "template": [
      "default",
      "templates/darkfx"
    ],

and you get a toggle button switching from light to dark.

JM2K69 commented 1 year ago

@JM2K69 If you add the darkfx theme as a template, then you get this for free:

Install the theme as per the instructions at https://github.com/steffen-wilke/darkfx.

Put the following in your docfx.json:

    "template": [
      "default",
      "templates/darkfx"
    ],

and you get a toggle button switching from light to dark.

Thanks but I need it for docfxv3 @paytools-master

ghost commented 1 year ago

Ah, sorry @JM2K69, I missed that (possibly as I was under the impression that docfxv3 is no more).

JM2K69 commented 1 year ago

I know v3 has been discontinued but for now for staticdoc it looks great on me and I love the theme.

ghost commented 1 year ago

Understood - I understand the team's decision, but it seems a shame that so much MS Learn goodness hasn't made it into DocFX. I wish I had time to contribute (sadly I don't) as it seems there is nothing else out there even close, but as it stands the mainstream version comes with quite a few frustrations in terms of presentation. (Please don't take personally DocFX team.)

(I had a go with v3 myself just now but in the absence of any documentation it is just too hard to get going it seems.)

JM2K69 commented 1 year ago

I will post a guide for docfx V3 I'have made some change on default theme and a Black theme stay tuned

JM2K69 commented 1 year ago

@paytools-master have a look here Black-theme and here White-theme

ghost commented 1 year ago

@JM2K69 Jérôme - many thanks for this. Is there a public documentation site I can see it in action?

FYI, although I haven't decided whether to use V3 or not, I was recently inspired by the work Jon Skeet has done with the Google Cloud .NET Client Libraries.

yufeih commented 1 year ago

dup of https://github.com/dotnet/docfx/issues/4568