UNPKG

2.34 kBSCSSView Raw
1// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
2// Licensed under the Apache License, Version 2.0.
3
4@import "colors";
5@import "flex";
6
7$pt-intent-colors: (
8 "primary": $pt-intent-primary,
9 "success": $pt-intent-success,
10 "warning": $pt-intent-warning,
11 "danger" : $pt-intent-danger,
12) !default;
13
14$pt-intent-text-colors: (
15 "primary": $blue2,
16 "success": $green2,
17 "warning": $orange2,
18 "danger" : $red2,
19) !default;
20
21$pt-dark-intent-text-colors: (
22 "primary": $blue5,
23 "success": $green5,
24 "warning": $orange5,
25 "danger" : $red5,
26) !default;
27
28@mixin intent-color($intentName) {
29 color: map-get($pt-intent-colors, $intentName);
30}
31
32@mixin position-all($position, $value) {
33 bottom: $value;
34 left: $value;
35 position: $position;
36 right: $value;
37 top: $value;
38}
39
40@mixin base-typography() {
41 font-size: $pt-font-size;
42 font-weight: 400;
43 letter-spacing: 0;
44 line-height: $pt-line-height;
45 text-transform: none;
46}
47
48@mixin running-typography() {
49 font-size: $pt-font-size;
50 line-height: 1.5;
51}
52
53@mixin heading-typography() {
54 color: $pt-heading-color;
55 font-weight: 600;
56
57 .#{$ns}-dark & {
58 color: $pt-dark-heading-color;
59 }
60}
61
62@mixin monospace-typography() {
63 font-family: $pt-font-family-monospace;
64 text-transform: none;
65}
66
67@mixin overflow-ellipsis() {
68 overflow: hidden;
69 text-overflow: ellipsis;
70 white-space: nowrap;
71 word-wrap: normal;
72}
73
74@mixin focus-outline($offset: 2px) {
75 outline: $pt-outline-color auto 2px;
76 outline-offset: $offset;
77 -moz-outline-radius: 6px;
78}
79
80@function border-shadow($alpha, $color: $black, $size: 1px) {
81 @return 0 0 0 $size rgba($color, $alpha);
82}
83
84// returns the padding necessary to center text in a container of the given height.
85// default line-height is that of base typography, 18px assuming 14px font-size.
86
87@function centered-text($height, $line-height: floor($pt-font-size * $pt-line-height)) {
88 @return floor(($height - $line-height) / 2);
89}
90
91// Removes the unit from a Sass numeric value (if present): `strip-unit(12px) => 12`
92// @see https://css-tricks.com/snippets/sass/strip-unit-function/
93
94@function strip-unit($number) {
95 @if type-of($number) == "number" and not unitless($number) {
96 @return $number / ($number * 0 + 1);
97 }
98
99 @return $number;
100}
101
102// Isolates z-indices
103
104@mixin new-render-layer() {
105 transform: translateZ(0);
106}