Redoc: Document theme options in readme

Created on 1 Jun 2018  路  9Comments  路  Source: Redocly/redoc

I'd like to volunteer to write usage of the theme options.

Any chance you can give me some guidance on how to use it so I can get started?

docs in progress

Most helpful comment

@imnotashrimp awesome! Thanks!

The preferred way to use a theme is to pass it in the options of Redoc.init call: https://github.com/Rebilly/ReDoc#advanced-usage-of-standalone-version:

Redoc.init('http://petstore.swagger.io/v2/swagger.json', {
  theme: {
    main: '#ff0000'
  }
}, document.getElementById('redoc-container'))

See the default theme for details: https://github.com/Rebilly/ReDoc/blob/master/src/theme.ts#L3

note you can use functions in the theme e.g.:

https://github.com/Rebilly/ReDoc/blob/63ae2e8e943b1cf2838db20c6c567156a2bfac45/src/theme.ts#L35

Theme can't be used on <redoc> tag attributes yet.

Feel free to ask additional question!

All 9 comments

@imnotashrimp awesome! Thanks!

The preferred way to use a theme is to pass it in the options of Redoc.init call: https://github.com/Rebilly/ReDoc#advanced-usage-of-standalone-version:

Redoc.init('http://petstore.swagger.io/v2/swagger.json', {
  theme: {
    main: '#ff0000'
  }
}, document.getElementById('redoc-container'))

See the default theme for details: https://github.com/Rebilly/ReDoc/blob/master/src/theme.ts#L3

note you can use functions in the theme e.g.:

https://github.com/Rebilly/ReDoc/blob/63ae2e8e943b1cf2838db20c6c567156a2bfac45/src/theme.ts#L35

Theme can't be used on <redoc> tag attributes yet.

Feel free to ask additional question!

So did I understand correctly that you can not theme ReDoc by using <redoc theme=""> at all the moment?

You have to use React component or Redoc.init to actually be able to theme anything?

@jjylha, yes, you've got it correctly.

@imnotashrimp Any updates on this?

Following

Following

Following

Following

Was this page helpful?
0 / 5 - 0 ratings