Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript type definitions #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
type IColorValue = string;

// color1

type IColor1Names =
| "black"
| "white";

type IColor1 = IColorValue;
type IColors1 = Record<IColor1Names, IColor1>;

// color2

type IColor2Names =
| "blueGrey"
| "brown"
| "grey";

type IColor2Shades =
| "50"
| "100"
| "200"
| "300"
| "400"
| "500"
| "600"
| "700"
| "800"
| "900";

type IColor2 = Record<IColor2Shades, IColorValue>;
type IColors2 = Record<IColor2Names, IColor2>;

// color3

type IColor3Names =
| "amber"
| "blue"
| "cyan"
| "deepOrange"
| "deepPurple"
| "green"
| "indigo"
| "lightBlue"
| "lightGreen"
| "lime"
| "orange"
| "pink"
| "purple"
| "red"
| "teal"
| "yellow";

type IColor3Shades =
| IColor2Shades
| "a100"
| "a200"
| "a400"
| "a700";

type IColor3 = Record<IColor3Shades, IColorValue>;
type IColors3 = Record<IColor3Names, IColor3>;

// icon

type IIconNames =
| "darkIcons"
| "lightIcons";

type IIconShades =
| "active"
| "inactive";

type IIcon = Record<IIconShades, IColorValue>;
type IIcons = Record<IIconNames, IIcon>;

// text

type ITextNames =
| "darkText"
| "lightText";

type ITextShades =
| "disabled"
| "dividers"
| "primary"
| "secondary";

type IText = Record<ITextShades, IColorValue>;
type ITexts = Record<ITextNames, IText>;

//

type IMaterialColors = IColors1 & IColors2 & IColors3 & IIcons & ITexts;
declare var materialColors: IMaterialColors;
export default materialColors;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "material-colors",
"homepage": "https://github.com/shuhei/material-colors",
"version": "1.2.6",
"version": "1.2.7",
"description": "Colors of Google's Material Design made available to coders",
"main": "dist/colors.js",
"module": "dist/colors.es2015.js",
Expand Down