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

Support for overriding table row colors? #199

Closed
kimsauce opened this issue Jun 10, 2022 · 10 comments · Fixed by #295
Closed

Support for overriding table row colors? #199

kimsauce opened this issue Jun 10, 2022 · 10 comments · Fixed by #295
Labels
bug Something isn't working help wanted PRs are encouraged and will be accepted styles

Comments

@kimsauce
Copy link
Contributor

kimsauce commented Jun 10, 2022

Hello Rohit, thank you for making this great plugin! I was wondering if there's a way to change the table row colors. I'm currently seeing an issue where they're rendering like this in dark mode. I've tried several ways, but now stumped.

darkmode-rows

We're also seeing a code block color contrast issue, in light mode only:
2022-08-24_09-59-08

@rohit-gohri rohit-gohri added bug Something isn't working styles labels Jun 10, 2022
@rohit-gohri
Copy link
Owner

Can you share an example OpenAPI/Swagger yaml that recreates this?

@kimsauce
Copy link
Contributor Author

Sure thing! Here you go, and many thanks for the quick response.

sumologic-api.yaml.zip

@rohit-gohri rohit-gohri added the help wanted PRs are encouraged and will be accepted label Jun 15, 2022
@kimsauce
Copy link
Contributor Author

kimsauce commented Aug 24, 2022

Hi @rohit-gohri , I'm still working on this one and feel like I'm getting closer! It may be something on our end, but could I run these ideas past you? cc @swiatekm-sumo

Our issues are the table row poor color contrast (in dark mode) and code snippet poor color contrast (in light mode). For your reference, here's our redocusaurus page and Redocly page .

  • Is it possible to import CSS directly into a yaml spec file?
  • Does redocusaurus accept override CSS code or entire CSS files in docusaurus.config.js?

redoc

redoc2

@rohit-gohri
Copy link
Owner

rohit-gohri commented Aug 24, 2022

Hey, thank you for taking the time to get to the bottom of this issue.

If you have fixed this with some custom css then I would be happy to merge the changes into the package itself (as long as it's not specific to your spec file). You can add your changes here and open a PR: https://github.com/rohit-gohri/redocusaurus/blob/main/packages/docusaurus-theme-redoc/src/theme/Redoc/styles.css

As for your questions:

Is it possible to import CSS directly into a yaml spec file?
Does redocusaurus accept override CSS code or entire CSS files in docusaurus.config.js?

The answer would be no to both, but redocusaurus is just React components and some config. So you could ideally just import the React component and use it directly like in this example: https://github.com/rohit-gohri/redocusaurus/blob/main/website/src/pages/examples/custom-page/index.jsx . And import the custom css in that file.

@kimsauce
Copy link
Contributor Author

Hi @rohit-gohri , I came back to this (almost a year later) and was able to resolve the issue using a custom class in our CSS!

.redocusaurus table > tbody > tr {
  border: 1px solid #F1F1F1;
  background-color: transparent;
  color: #000000;
}

Do you think this would work across the board for all users, they want to override? I've just picked plain colors here, but other users can choose what they want.

@rohit-gohri
Copy link
Owner

That looks good to me! Thanks for posting it back

I've just picked plain colors here

Maybe we can use css variables from the infima theme that docusaurus uses - https://github.com/facebookincubator/infima/blob/main/packages/core/styles/common/variables.pcss rather than hardcoded values?

@kimsauce
Copy link
Contributor Author

kimsauce commented May 27, 2023

Oh good call. This worked for me!

.redocusaurus table > tbody > tr {
  background-color: var(--ifm-table-cell-color) !important;
}

@rohit-gohri
Copy link
Owner

Awesome! It'll be great if you can open a PR for it, otherwise I'll add it whenever I get the time to work on this

@kimsauce
Copy link
Contributor Author

kimsauce commented May 31, 2023

Sure thing! Just created a PR for it here. I wasn't sure whether to put the code there or in the Docs (or both).

Thanks again for your help! Excited to use Redocusaurus 🦖

@rohit-gohri
Copy link
Owner

Released in 1.6.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted PRs are encouraged and will be accepted styles
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants