-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for light themes from bootswatch #745
Conversation
Adding everyone as a reviewer to bring this to your attention. Feel free to involve yourself (or not) in the discussion 🙂 |
Yes. It is an issue with npm 6: npm/npm#20434 You can prevent that from happening by (temporarily) downgrading to npm 5. Related: https://github.com/MarkBind/markbind-cli/wiki/Developer-Guide#troubleshooting (#582)
If we want to claim theming support, then we should have light/dark versions of almost everything. From your screenshot:
|
Shall we support only light themes at first? The need of the hour is for all MarkBind sites not to look exactly the same. That can be achieved with a range of light themes using different primary colors? |
@acjh @yamgent It's not so much a bug as it is a change in how
The download for the GitHub mark does have a light version for use on dark backgrounds, (and the GitHub navbar uses it) so a white on dark background logo should be OK. |
I didn't say it is a bug. It is an issue as the change is contentious.
I disagree. But @yamgent can decide for MarkBind. |
Let's stick with npm 5 for now and not risk potentially breaking something. |
13edb09
to
2beb325
Compare
094300f
to
fa4ddf4
Compare
Thanks for your inputs everyone! We have resolved the npm issue separately in #767, and I've updated this PR description accordingly. As discussed, we'll only support light themes for now. I'm ready to have the code reviewed - please take a look 🙂 And then after everything is ok, I will proceed with writing the user docs. |
docs/site.json
Outdated
@@ -29,6 +29,7 @@ | |||
} | |||
], | |||
"headingIndexingLevel": 6, | |||
"bootswatchTheme": "journal", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a temporary change, to illustrate what modifying the theme looks like from the user's perspective.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"theme": "bootswatch-journal"
is more future proof, in case we add support for other themes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, yeah that sounds better 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@damithc - Updated! How does this look now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
src/Site.js
Outdated
'spacelab', | ||
'united', | ||
'yeti', | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These correspond to subfolder names within bootswatch's node_modules
folder.
Spelling of the themes are double checked with https://bootswatch.com/api/4.json
fa4ddf4
to
94d2bbb
Compare
src/Site.js
Outdated
return fs.copyAsync(this.siteAssetsSrcPath, this.siteAssetsDestPath); | ||
const maybeOverrideDefaultBootstrapTheme = () => { | ||
const { theme } = this.siteConfig; | ||
if (!theme || !Object.prototype.hasOwnProperty.call(SUPPORTED_THEMES_PATHS, theme)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this check be simplified to _.has(SUPPORTED_THEMES_PATHS, theme)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, that definitely looks more readable. Done 👍
94d2bbb
to
9475633
Compare
Docs are up! 🎉 |
- [`bootswatch-spacelab`](https://bootswatch.com/spacelab/) | ||
- [`bootswatch-united`](https://bootswatch.com/united/) | ||
- [`bootswatch-yeti`](https://bootswatch.com/yeti/) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering about that too. The images have straightforward URLs and should be easy to add to our docs. I think it might be reasonable to do that with proper acknowledgements, but I'm not fully sure about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Themes are very visual things; it's best if we can provide a visual comparison. Also, we should avoid sending our users to external sites as much as possible.
Alternatively, we can duplicate the files in our site (but acknowledge the source). I think they use MIT license which allows duplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, I'll go ahead with that then!
28a84fc
to
bda3be3
Compare
@damithc I've added the images for easier visual comparison between the themes. How does this look now? |
Looks good, although the pics blends too well with the page due to white background in both. Perhaps put the whole lot inside a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍 Propose a merge commit message?
@yamgent How about the PR title? :) |
The PR title alone is insufficient in providing the context of the change. Proposed merge commit message:
|
Commit message: you can also mention why only light themes are being added. |
Whoops I thought you meant just the title of the merge commit. What you proposed sounds good to me! Re: light themes, maybe we can append this to what you wrote:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Note that #782 should cover not just page-nav
and site-nav
but also other custom components that currently do not have any bootstrap classes.
E.G. Questions and Modals among many others. They do not allow customisation of how it looks currently (unlike panels or badges). So you have to implement customisation for them if we want everything within MarkBind to support theming.
@damithc I've investigated this briefly and I think this involves modifying our Navbar custom component to use the For example, if we apply the Journal theme (https://bootswatch.com/journal/), the generated website will have a black navbar (the second one in the list) as opposed to the pink navbar that we see in the thumbnail. If we change the bootstrap class, the default navbar color will also change, based on the default bootstrap theme. Using
|
It would be good to take advantage of the different nav bar colors as the navbar plays an important role in making the site look 'different'. It depends on how much effort it will take though. May be senior devs have some thoughts? |
Let's continue this discussion in #386. |
What is the purpose of this pull request? (put "X" next to an item, remove the rest)
• [X] New feature
Fixes #547, Fixes #663
High-level approach
The goal here is to enable themes in MarkBind! Building on the discussion in #547, the approach I'm going for is to:
Incorporate bootswatch into the project via its npm package, instead of the other options. This is so that we can manage the dependency via npm, and be able to directly copy the css files without needing to download from a CDN.
During the asset-copying stage of site generation, use the custom
bootstrap.min.css
of the specified bootswatch theme instead of the default bootstrap file.Allow users to change the theme of their site by specifying the name of the theme in
site.json
. At this point, this will be a global setting - no further granularity will be supported e.g. in the frontmatter or layout.Non-goals
Things I would like your input on (edit: these are resolved, thanks everyone!)
I wanted this to get reviewed at its early draft stage so that we have a consensus about what I'll be working on, and how best to go about it. I would appreciate your feedback! Here are some open questions I have:
Is
npm install bootswatch
(no args) the right way to add it as a dependency? I feel uncomfortable seeing all the newly loosened version numbers inpackage-lock.json
, and it wasn't immediately obvious to me how I can prevent that from happening.Ideally we want every theme to look polished. But some of the things we're styling (e.g. code blocks, highlighting, colour of the GitHub logo) are fixed, and it might be super tedious to have to come up with custom or light/dark mode versions of everything. So I think there's some ambiguity regarding the scope of this feature, if we want to support all bootswatch themes nicely. Do you have any thoughts on this?
Do you have any concerns about the approach / next steps / anything that I've mentioned so far?
Example of what applying a diferent theme looks like