
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
shorted-theme
Advanced tools

npm i shorted-theme
import styled from 'styled-components'
import shorted from 'shorted-theme'
const theme = {
colors: {
primary: 'red',
secondary: 'blue'
},
fontFamily: '"Roboto", sans-serif',
fontSizes: {
small: 12,
regular: 14,
large: 18
}
}
const t = shorted(theme) // š short your theme then use everywhere.
const Button = styled.button`
color: ${t.colors.primary};
color: ${t.colors.primary};
font-family: ${t.fontFamily};
font-size: ${t.fontSizes.regular};
`
shorted-theme use all your typings.

You can destructure the shorted theme object. That way you can reference direct children properties instead of a root object.
const { colors, fontFamily, fontSizes } = shorted(theme)
const Button = styled.button`
color: ${colors.primary};
color: ${colors.primary};
font-family: ${fontFamily};
font-size: ${fontSizes.regular};
`
shorted-theme is useful for writing less when referencing theme values. However, it can't be used in expressions. For example:
// THIS WILL NOT WORK
const Button = styled.button`
padding: ${t.padding.default * 10};
`
Instead you should use the function expression:
const Button = styled.button`
padding: ${(props) => props.theme.padding.default * 10};
`
npm i.npm start or ./src/bin.jsnpm run test
Releases are triggered by npm version and handled by GitHub Actions.
FAQs
Shorted theme references for Styled Components.
We found that shorted-theme 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.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.