Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
theminator
Advanced tools
Theminator enhances the properties of your theme object with useful methods to help you more easily create derived values.
Theminator replaces the colors and dimensions (e.g. #123456
or 12rem
) in your theme with objects containing useful methods that you can use to create derived values, like a darkened version of the background color or a multiplied border width for a hover effect.
yarn add theminator
or
npm i theminator
import decorate from 'theminator';
A theme object needs to have at least a colors
key and a dimensions
key at the top level. Feel free to nest values as deep as you want, the only requirement is that primitive values need to be parseable as a color value or a dimension value respectively. The rest of the top level keys are ignored and can contain anything.
const theme = {
colors: {
button: {
primary: '#123456',
secondary: '#654321',
},
},
dimensions: {
borderWidth: '1px',
circle: {
borderRadius: '50%',
},
},
extra: 'I am ignored.',
};
export default decorate(theme);
// ...
import theme from '../theme';
const color = theme.colors.button.primary;
const borderWidth = theme.dimensions.borderWidth;
// ...
<button
className={css`
background: ${color.css()};
border-color: ${color.darken(2).css()};
border-width: ${borderWidth.value * 2} ${borderWidth.unit};
`}
>
...
</button>;
decorate(theme)
(default export)theme
: an object containing a colors
and a dimensions
key.
An enhanced object of the same shape. Color values are wrapped with chroma-js. Dimension values are replaced with an object of the shape { css: string, number: number, unit: string }
. If a value is not valid, the function throws.
decorateColors(colors)
colors
: an object containing color values. Values can be nested as deep as you want but they need to be valid.
An enhanced object of the same shape. Values are wrapped with chroma-js. Called internally by decorate()
.
decorateDimensions(dimensions)
dimensions
: an object containing dimension values. Values can be nested as deep as you want but they need to be valid.
An enhanced object of the same shape. Values are replaced with an object of the shape { css: string, number: number, unit: string }
. Called internally by decorate()
.
Below is a list of commands you will probably find useful.
npm start
or yarn start
Runs the project in development/watch mode.
npm run build
or yarn build
Bundles the package to the dist
folder.
npm test
or yarn test
Runs the test watcher (Jest) in an interactive mode.
FAQs
Theminator enhances the properties of your theme object with useful methods to help you more easily create derived values.
The npm package theminator receives a total of 1 weekly downloads. As such, theminator popularity was classified as not popular.
We found that theminator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.