Comments (2)
Again...know you guys aren't accepting pull requests but here's a working version with minimal changes:
/**
* @param argb ARGB representation of a color.
* @return Hex string representing color, ex. #ff0000 for red.
*/
export const hexFromArgb = (argb: number) => {
const a = colorUtils.alphaFromArgb(argb);
const r = colorUtils.redFromArgb(argb);
const g = colorUtils.greenFromArgb(argb);
const b = colorUtils.blueFromArgb(argb);
const outParts = [r.toString(16), g.toString(16), b.toString(16), a.toString(16)];
// Pad single-digit output values
for (const [i, part] of outParts.entries()) {
if (part.length === 1) {
outParts[i] = '0' + part;
}
}
return '#' + outParts.join('');
};
from material-color-utilities.
Going to see about implementing this.
My idea is to have no effect on the current operation of any fromArgb
functions, but to provide an optional final argument alpha: boolean = false
, which when set to true
will include the alpha value in the returned data.
I also intend to track the movement of color data through the library's various functions and classes and ensure that alpha data is preserved such that you can abuse and mangle data to your hearts content and expect the alpha value which went in to also come out the other end.
Above all though, existing code will perform exactly as it currently does.
from material-color-utilities.
Related Issues (20)
- Configuring image quantization quality to optimize performance HOT 2
- SchemeFidelity issue when dark mode with primary color "#000000" (black) HOT 1
- How do I create complete Material color palette with shades 90-900, with accent shades? HOT 3
- It can't export colorSurfaceContainer all colors in TypeScript HOT 2
- [TypeScript] miss some export in index.ts HOT 1
- get unexpect color
- Delphi Port
- Fix high-chroma issue in HCT Solver
- Figma and material builder generated colors differ HOT 1
- Web: Select tokens seem to be missing HOT 2
- Import Swift Package in iOS
- Hct and ScoredHCT capitalization
- How is this supposed to be used? All ways of importing don't work. HOT 2
- How to build a `DynamicScheme` from a `CorePalette`?
- Suppport Display P3 and other RGB color spaces
- Why is Hue at 0° not red?
- `DynamicScheme` is impossible to construct in TypeScript HOT 1
- It's horrible.
- [TypeScript]: `theme-utils` uses deprecated `Scheme` class
- Q: Concerning MCU expressive on-colors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from material-color-utilities.