Storybook-readme: Theme error when using Storybook 5.3+

Created on 22 Jan 2020  路  6Comments  路  Source: tuchk4/storybook-readme

This is a follow up to issue #220. I am having the same issue and I do not set a custom theme at all. I had to add the following to make the error go away:

addParameters({ options: { theme: {} } });

Most helpful comment

Ok, if anyone is looking for an up-to-date workaround with complete context, add this to your preview.js under your .storybook folder:

import { addParameters } from '@storybook/react';

addParameters({
  options: {
    theme: {}// this is just a workaround for addon-readme
  },
})

All 6 comments

In packages/storybook-readme/src/services/getParameters.js#L17, should be something like

...(parameters.options && parameters.options.theme ? parameters.options.theme : {})

Thanks @bbellmyers

FYI if you're using Typescript you need to define base;
.addParameters({ options: { theme: { base: '' } } });

This is happening to me too. What is exactly the solution? I don't see any concrete example.
I am configuring my theme as it is explained on the docs of storybook. Could you please explain to me what I have to do from the normal up to date configuration?

Ok, if anyone is looking for an up-to-date workaround with complete context, add this to your preview.js under your .storybook folder:

import { addParameters } from '@storybook/react';

addParameters({
  options: {
    theme: {}// this is just a workaround for addon-readme
  },
})

If I use the code proposed by @danielo515, I get "Passed an incorrect argument to a color function, please pass a string representation of a color" instead of the previous error. My version of Storybook is 5.3.19.

Was this page helpful?
0 / 5 - 0 ratings