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 1 commit
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
67 changes: 67 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
type IColorValue = string;

// color1

type IColor1Names = "black" | "white";
type IColor1 = IColorValue;
type IColors1 = { [name in IColor1Names]: IColor1 };

// color2

type IColor2Shades =
| "50"
| "100"
| "200"
| "300"
| "400"
| "500"
| "600"
| "700"
| "800"
| "900";
type IColor2Names = "blueGrey" | "brown" | "grey";
type IColor2 = { [shade in IColor2Shades]: IColorValue };
type IColors2 = { [name in IColor2Names]: IColor2 };

// color3

type IColor3Shades = IColor2Shades | "a100" | "a200" | "a400" | "a100";
uqee marked this conversation as resolved.
Show resolved Hide resolved
type IColor3Names =
| "amber"
| "blue"
| "cyan"
| "deepOrange"
| "deepPurple"
| "green"
| "indigo"
| "lightBlue"
| "lightGreen"
| "lime"
| "orange"
| "pink"
| "purple"
| "red"
| "teal"
| "yellow";
type IColor3 = { [shade in IColor3Shades]: IColorValue };
type IColors3 = { [name in IColor3Names]: IColor3 };

// icon

type IIconShades = "active" | "inactive";
type IIconNames = "darkIcons" | "lightIcons";
type IIcon = { [shade in IIconShades]: IColorValue };
type IIcons = { [name in IIconNames]: IIcon };

// text

type ITextShades = "disabled" | "dividers" | "primary" | "secondary";
type ITextNames = "darkText" | "lightText";
type IText = { [shade in ITextShades]: IColorValue };
type ITexts = { [name in 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