本文整理汇总了TypeScript中color.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: color
export const contrastBackground = (value: string) => {
const bg = color(value)
const fg = bg.isDark() ? theme.colors.lightText : theme.colors.darkText
return {
backgroundColor: value,
color: fg,
}
}
示例2: extractColor
function extractColor(value: string): Color {
if (process.env.NODE_ENV === 'test') { return Color('black') }
return Color(value)
}
示例3: color
mediaQueries: [],
fontWeights: {
bold: 700,
},
radii: [0, 2, 4, 8],
shadows: ["none", `0 2px 16px ${gray(75)}`],
fonts: {
body: "Cabin",
header: "Arvo",
sans: "Cabin",
serif: "Arvo",
mono: "PT Mono",
},
colors: {
link: "coral",
background: color("mediumseagreen").darken(0.06).string(),
lightBackground: "snow",
darkBackground: "darkslategray",
lightText: "snow",
darkText: color("darkslategray").darken(0.5).fade(0.15).string(),
teal: "rgb(0, 190, 166)",
},
from(key: string, values: any[]): any {
return values.map((x) => theme[key][x])
},
}
theme.mediaQueries = theme.breakpoints.map((w) =>
w === "52em" ? `@media print, (min-width: ${w})` : `@media(min-width: ${w})`
)
const mqBase = facepaint(theme.mediaQueries)
示例4: color
"main a": {
color: "inherit",
textDecoration: "none",
borderBottom: `2px dashed ${theme.colors.link}`,
transition: `all ${theme.transitionTime}`,
"&:hover, &:active": {
// borderBottomColor: "transparent",
color: theme.colors.link,
},
},
blockquote: {
borderLeftColor: theme.colors.link,
borderLeftStyle: "solid",
fontStyle: "italic",
backgroundColor: "lavenderblush",
color: color(theme.colors.darkText).fade(0.1).string(),
},
code: {
border: `1px solid ${theme.colors.link}`,
padding: 5,
borderRadius: 3,
...contrastBackground("seashell"),
"&.dark": contrastBackground(theme.colors.darkText),
}
})
export const hideOnPrint = css({
"@media print": {
display: "none",
}