Small changes on the design

Archives by Year - Month - Week - Day - Today

Post #236

EN

Small changes on the design

3 min read

Monday, 15 March 2021 16:03:53 by Khodok

Changes on the design (details)

What’s new

  • Nothing.

What changed

  • Design now has some fancy stuff integrated in it, more should be coming over time.

What’s next

  • A lot of small changes.
The code used for these changes (and other stuff too but for SCSS users this is pretty cool)

Note that this isn’t the final version and it still has some stuff that’ll move, also that there’s parts missing because then it’d be all the stuff around and the stuff around isn’t necesarry, this makes my colors and stuff using color gradients working, that’s it.

This code was also changed from the article it was found for my needs and I also changed one part that’ll be deprecated in Dart-Sass 2.0.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
$colors: (
    primary: #5444A6,
    secondary: #444749,
    danger: #F22A02,
    success: #18F23D,
    warning: #FF5533,
    info: #9D92D4,
    dark: #212121,
);

$variations: (
    'd2': (
        function: get-function(darken),
        parameters: 15%
    ),
    'd1': (
        function: get-function(darken),
        parameters: 10%
    ),
    'l1': (
        function: get-function(lighten),
        parameters: 5%
    ),
    'l2': (
        function: get-function(lighten),
        parameters: 20%
    ),
    'fade': (
        function: get-function(rgba),
        parameters: .7
    ),
    'gray': (
        function: get-function(grayscale)
    ),
    'shade': (
        function: get-function(mix),
        parameters: white 80%
    )
);

@function color-variation($color, $variation: false) {

    @if map-has-key($colors, $color) {
        $color: map-get($colors, $color);
    } @else {
        @if type-of($color) != color {
            @error "Invalid color name: `#{$color}`.";
        }
    }

    @if $variation {
        @if not map-has-key($variations, $variation) {
            @error "Invalid $variation: `#{$variation}`.";
        } @else {
            $this-variation: map-get($variations, $variation);
            $args: join(map-get($this-variation, function), $color);
            @if map-get($this-variation, parameters) {
                $args: join($args, map-get($this-variation, parameters));
            }
            @return call($args...);
        }
    }
    @return $color;
}

@function cv($color, $variation:false) {
    @return color-variation($color, $variation);
}

$primary: cv(primary);
$secondary: cv(secondary);
$success: cv(success);
$danger: cv(danger);
$warning: cv(warning);
$info: cv(info);

@mixin khoblog-gradient($color1, $color2) {
    background: radial-gradient(circle at top left, $color1, $color2);
}

@each $name, $color in $colors {

    .gradient-#{$name} {
        @include khoblog-gradient(cv($color), $color);
        background-repeat: no-repeat;
        background-attachment: fixed;
    }

    .gradient-#{$name}-i {
        @include khoblog-gradient($color, cv($color));
        background-repeat: no-repeat;
        background-attachment: fixed;
    }

    .gradient-text-#{$name} {
        background: -webkit-radial-gradient(cv($color), $color);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .gradient-text-#{$name}-i {
        background: -webkit-radial-gradient($color, cv($color));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .gradient-btn-#{$name} {
        @include khoblog-gradient(cv($color), $color);
        background-repeat: no-repeat;
        background-attachment: fixed;

        &:hover {
            background-color: darken($color, 10%) !important;
            background-repeat: no-repeat;
            background-attachment: fixed;
        }
    }

    .gradient-btn-#{$name}-i {
        @include khoblog-gradient($color, cv($color));
        background-repeat: no-repeat;
        background-attachment: fixed;
        color: $white !important;

        &:hover {
            background-color: darken($color, 10%);
        }
    }

    .btn-#{$name} {
        color: $white;
        background-color: $color;

        &:hover {
            color: $white !important;
            background-color: darken($color, 10%);
        }
    }

    .text-#{$name} {
        color: $color;
    }

    .hr-#{$name} {
        border: 2px solid $color;
    }

    @each $name-variation, $variation in $variations {

        .gradient-#{$name}-#{$name-variation} {
            @include khoblog-gradient(cv($color, $name-variation), $color);
            background-repeat: no-repeat;
            background-attachment: fixed;
        }

        .gradient-#{$name}-#{$name-variation}-i {
            @include khoblog-gradient($color, cv($color, $name-variation));
            background-repeat: no-repeat;
            background-attachment: fixed;
        }

        .gradient-text-#{$name}-#{$name-variation} {
            background: -webkit-radial-gradient(cv($color, $name-variation), $color);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .gradient-text-#{$name}-#{$name-variation}-i {
            background: -webkit-radial-gradient($color, cv($color, $name-variation));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .gradient-btn-#{$name}-#{$name-variation} {
            @include khoblog-gradient(cv($color, $name-variation), $color);
            background-repeat: no-repeat;
            background-attachment: fixed;
            color: $white !important;

            &:hover {
                background-color: darken(cv($color, $name-variation), 10%) !important;
                background-repeat: no-repeat;
                background-attachment: fixed;
            }
        }

        .gradient-btn-#{$name}-#{$name-variation}-i {
            @include khoblog-gradient($color, cv($color, $name-variation));
            background-repeat: no-repeat;
            background-attachment: fixed;
            color: $white !important;

            &:hover {
                color: $white !important;
                background: darken(cv($color, $name-variation), 10%);
            }
        }

        .btn-#{$name}-#{$name-variation} {
            color: $white;
            background: cv($color, $name-variation);

            &:hover {
                color: $white !important;
            }
        }

        .text-#{$name}-#{$name-variation} {
            color: cv($color, $name-variation);
        }

        .hr-#{$name}-#{$name-variation} {
            border: 2px solid cv($color, $name-variation);
        }
    }
}
I found this code on SitePoint