
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@daviddarnes/contrast-details
Advanced tools
A Web Component to display the contrast ratio and level of two colours using CSS custom properties
contrast-details
A Web Component to display the contrast ratio and level of two colours using CSS custom properties
Demo | Custom template demo | Further reading
General usage example:
<script type="module" src="contrast-details.js"></script>
<contrast-details
style="--foreground: #444; --background: #ccc"
></contrast-details>
<contrast-details
style="--foreground: #444; --background: #613fe8"
></contrast-details>
Example using inherited values:
<script type="module" src="contrast-details.js"></script>
<div style="--foreground: #444">
<contrast-details style="--background: #ccc"></contrast-details>
<contrast-details style="--background: #ffffff"></contrast-details>
<contrast-details style="--background: #613fe8"></contrast-details>
</div>
Example using level
attribute for styling
<style>
contrast-details[level^="aa"] [data-key="level"]::after {
content: " ✅";
}
contrast-details[level="fail"] [data-key="level"]::after {
content: " ❌";
}
</style>
<script type="module" src="contrast-details.js"></script>
<contrast-details
style="--foreground: #444; --background: #ccc"
></contrast-details>
<contrast-details
style="--foreground: #444; --background: #613fe8"
></contrast-details>
Example using a custom template:
<script type="module" src="contrast-details.js"></script>
<template id="contrast-details-template">
<p>
Contrast: <span data-key="ratio"></span> –
<span data-key="level"></span>
</p>
</template>
<contrast-details
style="--foreground: #444; --background: #ccc"
></contrast-details>
<contrast-details
style="--foreground: #444; --background: #613fe8"
></contrast-details>
This Web Component allows you to:
level
attribute selector to style elements differently depending on aaa
, aa
and fail
gradesYou have a few options (choose one of these):
npm install @daviddarnes/contrast-details
Make sure you include the <script>
in your project (choose one of these):
<!-- Host yourself -->
<script type="module" src="contrast-details.js"></script>
<!-- 3rd party CDN, not recommended for production use -->
<script
type="module"
src="https://www.unpkg.com/@daviddarnes/contrast-details@1.1.0/contrast-details.js"
></script>
<!-- 3rd party CDN, not recommended for production use -->
<script
type="module"
src="https://esm.sh/@daviddarnes/contrast-details@1.1.0"
></script>
With thanks to the following people:
FAQs
A Web Component to display the contrast ratio and level of two colours using CSS custom properties
The npm package @daviddarnes/contrast-details receives a total of 11 weekly downloads. As such, @daviddarnes/contrast-details popularity was classified as not popular.
We found that @daviddarnes/contrast-details 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.