Skip to content
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

Dark mode #1861

Closed
AEsmerio opened this issue Oct 11, 2019 · 32 comments
Closed

Dark mode #1861

AEsmerio opened this issue Oct 11, 2019 · 32 comments

Comments

@AEsmerio
Copy link

I've searching a lot how people have implemented a Dark Theme / Dark Mode but no success so far.
I'm planing to move my own project from Vuetify to Buefy, but Dark theme is required.
On Vuetify you only need set a prop in the component and it's done. So I can toggle the entire app from Light to Dark.

Am I right to say that there's no such thing as Dark mode property for the components?

@service-paradis
Copy link
Collaborator

You're right. There is no specific dark mode in Buefy right now.
You can customize the Bulma Settings to create your own dark theme. There are some interesting ones at https://jenil.github.io/bulmaswatch/

@jtommy jtommy added the bulma label Oct 15, 2019
@jtommy
Copy link
Member

jtommy commented Oct 15, 2019

@3rdSenna Bulma author is working on it, stay tuned!!

@franzvezuli
Copy link

franzvezuli commented Jan 7, 2020

@3rdSenna Bulma author is working on it, stay tuned!!

Nice, great news! Is it tracked in a version or branch somewhere? Care to link? Want to watch it.
Edit: Just realized you said "Bulma" and not "Buefy", read it wrong, sorry!

@WaldemarEnns
Copy link

I am waiting for it too :) Just like @3rdSenna , i saw it already on Vuetify and would love to have this feature in Buefy too! 🚀

@nicolaipre
Copy link

Would absolutely be nice to see a builtin dark mode implemented :-)

@a-kriya
Copy link
Contributor

a-kriya commented Feb 29, 2020

Perhaps this issue can be closed as it is a duplicate of #2076. Once the PR for it is merged, the variables can be configured as documented here https://bulma.io/2019/10/15/light-dark-colors/#scheme-variables-for-dark-mode.

@jtommy
Copy link
Member

jtommy commented Feb 29, 2020

@a-kriya I don't think we'll able to get a dark mode like Vuetify

@a-kriya
Copy link
Contributor

a-kriya commented Feb 29, 2020

Which is okay since Bulma doesn't do it that way. It would be a fairly large deviation from Bulma if Buefy were to implement dark modes for individual components like Vuetify. If this ticket is marked as a feature request, is that something you're considering?

@jtommy
Copy link
Member

jtommy commented Feb 29, 2020

No, probably when bulma is going to release CSS variables feature, do you know other way?

@a-kriya
Copy link
Contributor

a-kriya commented Feb 29, 2020

Nope. Either way, it's dependent on Bulma. I'm trying to see what can be done under this ticket.

@a-kriya
Copy link
Contributor

a-kriya commented Feb 29, 2020

Basically, would it help clean up tickets here by direct users to Bulma's issues section if a feature/fix must come from there?

@jtommy
Copy link
Member

jtommy commented Feb 29, 2020

Is there an open issue?

@a-kriya
Copy link
Contributor

a-kriya commented Feb 29, 2020

Not exactly, but jgthms/bulma#2342 along with jgthms/bulma#1837 would be close. Regardless, if there are tickets here which cannot really be addressed without underlying support from Bulma, should they not be moved to that repo?

@mapellidario
Copy link

Hello!

I saw in jgthms/bulma#2342 a recent comment by jgthms: jgthms/bulma#2342 (comment) .

Would that help you closing this issue?

(anyway, kudos for all the good work ❤️ ❤️ )

@jtommy
Copy link
Member

jtommy commented May 14, 2020

@mapellidario all depends on Bulma otherwise I should add an external to provide it. What would you do ?

@jtommy
Copy link
Member

jtommy commented May 26, 2020

Waiting an official way, take a look at https://buefy.org/extensions/bulmacssvars

@Tofandel
Copy link
Contributor

Tofandel commented Jun 22, 2020

My PR would solve the issue of individual component themes and toggling by a simple data attribute jgthms/bulma#2981
So adding the reference for tracking
If it's not accepted, even to a small extent, I guess we can lynch bulma and start a fork with a community rather than a godlike maintainer since it's lightweight and 5 maintainers would largely have the capacity to maintain it (like it was proposed in #2090)

@JenuelDev
Copy link

ops, its 2021 and dark mode still not added?

@tassoman
Copy link

Be careful, 2020 isn't finished yet 😏
I've accomplished easily using one of the Bulmaswatch themes

@JenuelDev
Copy link

Be careful, 2020 isn't finished yet 😏
I've accomplished easily using one of the Bulmaswatch themes

Oh nice, I about to create a project using Buefy, hoping I can use it In the future. :)

@joaopedroAnelli
Copy link

I did this in my project using bulma css vars and Nuxt color mode. It's a workaround, of course, but it reached my goal while we don't have dark mode natively in buefy.

@vikiival
Copy link
Contributor

vikiival commented May 3, 2021

@jtommy is there any progress with this issue?
Or a simple tutorial would be amazing.

@jtommy
Copy link
Member

jtommy commented May 3, 2021

No, the only available options are already discussed in the previous messages.
It shouldn't be a Buefy feature since the major part of CSS comes from Bulma

@joeyboey
Copy link

I did this in my project using bulma css vars and Nuxt color mode. It's a workaround, of course, but it reached my goal while we don't have dark mode natively in buefy.

@joaopedroAnelli could you share your config and sass files? I can't get it to work. npm run bulma-css-vars does not even find the js file...

@Wakeful-Cloud
Copy link

Wakeful-Cloud commented May 28, 2021

@joeyboey

Colors

Here are the colors I used to make wakefulcloud.me (Which is built with Buefy) (EDIT: not any more, but the below should still work):

Name Dark Mode Color Light Mode Color
scheme-main #1a1a1a #ffffff
scheme-invert #000000 #0a0a0a
text #b5b5b5 #4a4a4a
text-invert #c9c9c9 #ffffff

Setup

  1. Create a file named bulma-css-vars.config.js (in the root of your project) with the below as content:
//Must be CommonJS export
module.exports = {
  colorDefs: { //This will default to dark mode (Update with light mode colors to default to light mode)
    'scheme-main': '#1a1a1a',
    'scheme-invert': '#000000',
    'text': '#b5b5b5',
    'text-invert': '#c9c9c9'
  },
  cssFallbackOutputFile: './src/bulma-generated/generated-fallbacks.css',
  jsOutputFile: './src/bulma-generated/bulma-colors.js', //Change to ".ts" to make output TypeScript
  sassEntryFile: './src/style/main-sass-file.sass', //This file needs to exist before you run the bulma-css-vars command
  sassOutputFile: './src/bulma-generated/generated-vars.sass',
  transition: '0.5s ease'
};
  1. Create a file named main-sass-file.sass in the src/style directory with the below as content:
//Import order matters
@import './bulma-generated/generated-fallback.css';
@import './bulma-generated/generated-vars.sass';
@import '../node_modules/bulma-css-vars/bulma-cv-lib';
  1. Run the update script from the root of your project (Without any arguments):
node ./node_modules/bulma-css-vars/bin/bulma-css-vars.js
  1. To invert the theme, instantiate a ColorUpdater and update the colors with the colors opposite of the current theme from the above table (See the TypeScript example in Bulma CSS Vars for more information)

A few very important things:

  • You must use CommonJS exports for bulma-css-vars.config.js (module.exports)
  • Some Bulma variables aren't supported (See #20)
  • sassEntryFile must exist before you run the bulma-css-vars command
  • The import order of sassEntryFile is imporant

@joeyboey
Copy link

@Wakeful-Cloud

Thanks for your detailed answer, I have one problem however. If I also set the primary color in the bplma-css-vars.config.js the color is only applied for a few components, mainly buttons and dropdowns.

But it is not applied for sliders and a lot of other ui elements and selections etc.

Do you have any advice on this?

// Must be CommonJS export
module.exports = {
  // This will default to dark mode (Update with light mode colors to default to light mode)
  colorDefs: {
    primary: '#0d5d6a',
    'primary-light': '#4da9b8',
    'primary-dark': '#091a28',
    'scheme-main': '#1a1a1a',
    'scheme-invert': '#000000',
    text: '#b5b5b5',
    'text-invert': '#c9c9c9',
  },
  cssFallbackOutputFile: './bulma-generated/generated-fallback.css',
  jsOutputFile: './bulma-generated/bulma-colors.ts', // Change to ".ts" to make output TypeScript
  sassEntryFile: './assets/main.scss', // This file needs to exist before you run the bulma-css-vars command
  sassOutputFile: './bulma-generated/generated-vars.sass',
  transition: '0.5s ease',
  options: { implementation: require('sass') },
}

@Wakeful-Cloud
Copy link

Wakeful-Cloud commented Jun 13, 2021

@joeyboey Try setting the primary colors in the entry SCSS file (./assets/main.scss) instead (Above the imports from step 2):

//Customize global theme
$primary: #0d5d6a;
$primary-light: #4da9b8;
$primary-dark: #091a28;

//Import order matters
@import './bulma-generated/generated-fallback.css';
@import './bulma-generated/generated-vars.sass';
@import '../node_modules/bulma-css-vars/bulma-cv-lib';

This should work (It's what I did for wakefulcloud.me), but, you won't be able to dynamically change the primary color anymore. You could also try identifying the exact (primary) color of the components you'd like to change using your browser's inspector, convert that color from hex to hsl, then search for it on Bulma's variable documentation, then finally add whatever variable you found to bulma-css-vars.config.js (This is how I figured out what variables I needed to change for the dark theme).

@joeyboey
Copy link

@Wakeful-Cloud

Thanks a lot for your tips again. I had the order flipped..
But the problem strangely persists. Both the steps and button component use background-color as their is-primary attribute. Button works just fine, step component stays in the buefy default rgb(121, 87, 213)

@Wakeful-Cloud
Copy link

@joeyboey

  1. Make sure you rebuild bulma-css-vars (Otherwise bulma-css-vars and ./assets/main.scss will have colliding variable definitions).
  2. Try removing primary-light and primary-dark
  3. Try without bulma-css-vars and see if the step component changed (Though it'll be light mode). If this works, then gradually reintroduce bulma-css-vars and see where it breaks.

If none of the above work, you may want to open an issue with Bulma itself.

@TheJaredWilcurt
Copy link

The lack of a dark mode button to toggle the docs is what made me not use this library.

@mary-josephine-1
Copy link

Hi, any update on this?

@wesdevpro
Copy link
Member

wesdevpro commented Dec 7, 2023

At the moment due to the migration from Vue2 to Vue3 there has been little progress on feature requests.

For now, you will have to find a way to change the color schema via bulma CSS which is what Buefy is built upon.

See: jgthms/bulma#2342

https://github.com/jgthms/bulma/tree/css-variables-with-fallback

@wesdevpro wesdevpro closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests