insomnia/packages/insomnia-components/README.md

15 lines
745 B
Markdown
Raw Normal View History

2020-04-26 20:33:39 +00:00
# insomnia-components
2022-03-01 12:52:10 +00:00
`insomnia-components` is a React component library of UI elements needed to build [Insomnia](https://insomnia.rest).
2020-04-26 20:33:39 +00:00
2021-08-27 03:44:01 +00:00
## SVGs
2020-04-26 20:33:39 +00:00
We use [SVGR](https://react-svgr.com) on the source SVGs to minify and convert them to React components. This conversion happens during `npm run bootstrap`.
The generated icons can automatically be bound to the theme library built into Insomnia, by following a few rules. In the source SVG:
2021-08-27 03:44:01 +00:00
2020-04-26 20:33:39 +00:00
1. All background colors should be black (#000)
2021-08-27 03:44:01 +00:00
1. All foreground colors should be white (#FFF)
2020-04-26 20:33:39 +00:00
SVGR converts these colors to `fill=''` and `fill='currentColor'` respectively. These icons are exposed via `svg-icon.js`, which sets the css `fill` and `color` of the SVG according to the required theme.