Gathering detailed insights and metrics for pixel-perfect
Gathering detailed insights and metrics for pixel-perfect
Gathering detailed insights and metrics for pixel-perfect
Gathering detailed insights and metrics for pixel-perfect
fancy-canvas
Functionality on top of HTML canvas element, including support for HiDPI and pixel-perfect rendering
@alita/inspx
Pixel perfect layout inspection.
react-native-pixel-perfect
helps you create pixel perfect apps by design
pixel-react
Great for pixel-perfect, design-focused components in React
A pixel perfect SCSS stylesheet. Spiced with themeable mixins, custom CSS variables and other cool stuff you can handpick from.
npm install pixel-perfect
Typescript
Module System
Node Version
NPM Version
CSS (56.44%)
HTML (23.75%)
TypeScript (15.99%)
JavaScript (3.81%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
2 Stars
83 Commits
2 Watchers
2 Branches
1 Contributors
Updated on Mar 25, 2020
Latest Version
2.0.26
Package Id
pixel-perfect@2.0.26
Unpacked Size
45.58 kB
Size
11.26 kB
File Count
3
NPM Version
6.2.0
Node Version
10.8.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
No dependencies detected.
A pixel perfect SCSS stylesheet (demo: https://pixel-perfect-39e99.firebaseapp.com/). Spiced with themeable mixins, custom CSS variables and other cool stuff you can handpick from.
Pixel perfect definition:
Each pixel is intentionally being used to the fullest for the sharpest, cleanest look.
$ npm i pixel-perfect --save
@import "~pixel-perfect/pixel-perfect.scss";
You can include everything from the layout.
@include pp-layout();
Or you can handpick the styles you want. Let's say you only want the grid and the typography.
@include pp-grid();
@include pp-typography();
Create a theme (or multiple themes) for your app.
@mixin light-theme() {
@include css-vars(pp-palette("primary", $pp-yellow));
@include css-vars(pp-palette("accent", $pp-orange));
@include css-vars(pp-palette("warn", $pp-red));
@include css-vars(pp-palette("error", $pp-orange));
@include css-vars(pp-palette("success", $pp-black-dirty));
@include css-vars((
--navbar-color: white,
--navbar-bg: map-get($pp-yellow, 500),
--app-text: black,
--app-bg: white
));
}
Include the mixins in your stylesheet. You could for example scope the themes in classes to quickly switch between themes on runtime.
.theme-light {
@include light-theme();
}
.theme-dark {
@include dark-theme();
}
You might be wondering what variables the css-vars(pp-palette(...))
spits out. The palette function spits out all the nessesary key-value pairs for the palette. Look below what variables we are talking about.
$pp-blue: (
500: #4581F6,
400: light-color(#4581F6),
600: dark-color(#4581F6),
contrast: (
500: $white-87-opacity,
400: $white-87-opacity,
600: $white-87-opacity
)
);
@include css-vars(pp-palette("primary", $pp-blue), $root: true);
:root {
--primary-default: pp-map-get($colors, $default)
--primary-lighter: pp-map-get($colors, $lighter),
--primary-darker: pp-map-get($colors, $darker),
--primary-default-contrast: pp-contrast($colors, $default),
--primary-lighter-contrast: pp-contrast($colors, $lighter),
--primary-darker-contrast: pp-contrast($colors, $darker)
--primary-500: pp-map-get($colors, 500),
--primary-500-contrast: pp-contrast($colors, 500)
--primary-600: pp-map-get($colors, 600),
--primary-600-contrast: pp-contrast($colors, 600)
--primary-400: pp-map-get($colors, 400),
--primary-400-contrast: pp-contrast($colors, 400)
}
The variables can be used in your stylesheets by using the var(args...)
function. If you want the primary default color you could grab it by using var(--primary-default)
. The theming in pixel-perfect uses custom CSS variables out of the box. Unfortunately, not all browsers support custom CSS variables yet (See current state). Therefore you can set the flag $css-vars-use-native: false;
to tell pixel-perfect to use SASS variables instead. We recommend that you use custom CSS variables to get all the sweet benefits and either serve a seperate stylesheet for browsers without custom CSS variables or use polyfills.
If you want to deactivate you can do the following by extracting all of your theme related sass into one mixin that you can reuse with different variables:
// Deactive custom CSS variables :,(
$css-vars-use-native: false;
.theme-light {
@include light-theme();
@include demo-theme();
}
.theme-dark {
@include dark-theme();
@include demo-theme();
}
Its possible to customize most of the variables used in pixel-perfect.
@import "~pixel-perfect/pixel-perfect.scss";
$font-size-h1: 20rem;
$font-size-h2: 17rem;
$space-s: 5rem;
$space-m: 10rem;
$space-l: 15rem;
...
Here is an example of what your theme could look like.
@mixin demo-theme() {
body {
color: var(--app-text);
background: var(--app-bg);
}
}
Go from general to concrete in the naming. Examples could be "property-element" or "property-state".
$font-size-base-screen-l: 17px !default;
$font-size-l: px-to-rem(18) !default;
$font-size-m: px-to-rem(15) !default;
$font-size-h1: px-to-rem(50) !default;
$font-size-h2: px-to-rem(32) !default;
$font-weight-h1: $font-weight-bold !default;
$font-weight-h2: $font-weight-thin !default;
$space-screen-s: px-to-rem(20) !default;
Its fine to use the module name (eg. "button") as prefix.
$button-border: none !default;
$button-border-radius: px-to-rem(6) !default;
$button-font-size: $font-size-h4 !default;
$button-line-height: 100% !default;
$button-transition: all 200ms ease !default;
Heres an overview of some of the sweet mixins that can generate classes for you.
@include pp-normalize();
@include pp-color-classes();
@include pp-elevation-classes();
@mixin pp-layout() {
@include pp-normalize();
@include pp-global();
@include pp-typography();
@include pp-grid();
}
@mixin pp-layout-helpers() {
@include pp-layout-helpers-padding();
@include pp-layout-helpers-margin();
@include pp-layout-helpers-display();
@include pp-layout-helpers-alignment();
}
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More