![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.
dynamic-css-properties
Advanced tools
This tiny library exposes a single function in order to dynamically set custom CSS properties (CSS variables).
camelCased
property names to --kebab-case
for you.document.documentElement
, i.e. the root node, but allows you to
specify a subnode to update instead (custom CSS properties follow the
standard cascading rules).yarn add dynamic-css-properties
ES6 modules:
import setCustomProperties from 'dynamic-css-properties';
CommonJS:
const setCustomProperties = require('dynamic-css-properties');
Script tag (adds a setCustomProperties
global):
<script src="https://unpkg.com/dynamic-css-properties@0.1.1/dist/dynamic-css-properties.min.js"></script>
A minimal example:
setCustomProperties({
primaryTextColor: 'hotpink',
backgroundColor: 'papayawhip',
});
Now simply use the variables:
body {
color: var(--primary-text-color, #1e1e1e);
background-color: var(--background-color, #fff);
}
As soon as the code is executed, the custom properties will be added to the document. Should you wish to only update part of the document you may specify a particular node as the second argument, and only it and its children will be affected.
Using this for serious business is not a good idea, unless you know that all your users are running browsers or environments (such as Electron) that support custom CSS properties. See here.
FAQs
CSS custom properties made dynamic.
The npm package dynamic-css-properties receives a total of 0 weekly downloads. As such, dynamic-css-properties popularity was classified as not popular.
We found that dynamic-css-properties 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
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.