question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Storybook `brandTitle` and `brandLogo` is not working with `storybook-dark-mode`

See original GitHub issue

Input ==>>

// .storybook/manager.js

import { addons } from "@storybook/addons";
import { create } from "@storybook/theming";

addons.setConfig({
  theme: create({
    base: "light",
    brandTitle: "foo",
    brandUrl: "https://www.xyz.com/",
    brandImage:
      "https://manufac-analytics-images.s3.ap-south-1.amazonaws.com/logos/landscape/black/Manufac_Final-2.png",
  }),
});

Output ===>> image

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
nikkipantonycommented, Oct 14, 2021

I had this same problem, I have solved it by removing all theming from .storybook/manager.js and instead added it under light in .storybook/preview.js .

This is working but I now get a flash of Storybooks default theming before my custom theme loads 😦

// .storybook/preview.js

import { themes } from "@storybook/theming"
import storybookBrandImage from "./StorybookBrandImage.png"

export const parameters = {
    darkMode: {
        current: "light",
        light: {
            ...themes.normal,

            brandTitle: "yourTitle", 
            brandUrl: "yourURL",
            brandImage: storybookBrandImage, 

       }
       dark: {
            ...themes.dark,

       }
   }
}

If anyone knows a solution to the default theming flash before my custom theming loads, please let me know 🙏🏽

4reactions
Miguel-Bento-Githubcommented, Dec 16, 2021

@nikkipantony Solution is great and the only thing I can add to improve this workaround is that you can keep yourTheme.js file, export it and spread it.

// yourTheme.js
export const brandTheme = {
  light: {
    base: "light",
    colorPrimary: "#222",
    colorSecondary: "#eed457",
    brandTitle: "JS",
    brandUrl: "https://en.wikipedia.org/wiki/JavaScript",
    brandImage:
      "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6a/JavaScript-logo.png/600px-JavaScript-logo.png",
  },
};
// preview.js
import { themes } from "@storybook/theming";
import { brandTheme } from "./theme";

export const parameters = {
  darkMode: {
    current: "light",
    light: {
      ...themes.normal,
      ...brandTheme.light,
    },
    dark: {
      ...themes.dark,
    },
  },
};

Thanks Nikki!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Theming - Storybook
Storybook is a frontend workshop for building UI components and pages in isolation. Thousands of teams use it for UI development, testing, and...
Read more >
storybook-dark-mode - Bountysource
Having issues when switching stories. We run storybook with onDeviceUI: false and when I switch story the app goes back to light mode....
Read more >
Storybook React with Dark Mode Option - David Yeiser
Animated image showing the Storybook user interface and the React component in the main preview window. We will use the storybook-dark-mode ...
Read more >
storybook-facelift - npm
Start using storybook-facelift in your project by running `npm i storybook-facelift`. There are no other projects in the npm registry using ...
Read more >
storybook-dark-mode from hipstersmoothie - Coder Social
AFAIK, there isn't a way to customize the classTarget to point it at another attribute. Storybook `brandTitle` and `brandLogo` is not working with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found