![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@scalar/themes
Advanced tools
Scalar Themes provides a library of themes for all Scalar products and components. It also contains the base set of Scalar CSS variables and an associated Tailwind preset which leverages those variables.
To see a list of available themes, see the presets
export.
The themes package uses two CSS Layers to apply the theme styles
scalar-base
: A copy of the core Scalar CSS variables and default themescalar-theme
: Optionally overrides scalar-base
with theme stylesAny styles added outside of these layers will override all the styles in the layers which allows you to extend or customize a theme.
Because many Scalar applications are embedded into other websites the reset is scoped to the scalar-app
class. This means you need to add this class to the root element of your application where you want the theme to apply. If you are using the themes in a standalone application, you can just add this class to the body
element.
<body class="scalar-app">
<!-- Your application content -->
</body>
pnpm i @scalar/themes
To import the basic theme styles into your project, you can just import style.css
which imports the reset, scrollbars, and a copy of the base Scalar CSS variables and default theme.
import '@scalar/themes/styles.css'
To add a theme, you can import the theme from the presets directory.
import '@scalar/themes/presets/alternate.css'
To use the themes package via JavaScript, you can use the getThemeStyles
function from the package. The function will generate CSS style string which you can then add to the head of your document.
import { getThemeStyles } from '@scalar/themes'
const styles = getThemeStyles('alternate', { layer: 'scalar-theme' })
document.head.insertAdjacentHTML('beforeend', `<style>${styles}</style>`)
The function allows you to pass in a theme ID and an optional options object to configure the layer (default: scalar-theme
) and whether to include the default fonts (default: true
).
To use the themes package with Tailwind, you first need to inject the import the styles either via CSS or JavaScript (see above). You can also import them alongside your global Tailwind styles.
@import '@scalar/themes/style.css';
@tailwind components;
@tailwind utilities;
@tailwind variants;
Then you can use the tailwind preset in your tailwind.config.js
to expose the theme colors and variables.
import scalarPreset from '@scalar/themes/tailwind'
import { type Config } from 'tailwindcss'
export default {
presets: [scalarPreset],
// Your tailwind config
theme: {
extend: {
// Extend the preset
},
// Override the preset
},
} satisfies Config
FAQs
the default CSS variables for all Scalar packages
The npm package @scalar/themes receives a total of 43,948 weekly downloads. As such, @scalar/themes popularity was classified as popular.
We found that @scalar/themes demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.