Skip to content

Commit a8aca72

Browse files
authored
Registry entry colors in dark mode, and some style cleanup (#8498)
1 parent 1f82add commit a8aca72

File tree

4 files changed

+39
-37
lines changed

4 files changed

+39
-37
lines changed

assets/scss/_dark-adjustments.scss

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Dark-mode color contrast adjustments
2+
3+
@include color-mode(dark) {
4+
.otel-icon {
5+
filter: brightness(0) invert(1);
6+
}
7+
}
8+
9+
// Make box-shadow color contrast more obvious in dark mode.
10+
// https://github.com/twbs/bootstrap/issues/39053 reports this issue.
11+
// TODO: upstream this to Docsy.
12+
13+
$box-shadow-alpha-dark: 0.8 !default;
14+
// Note: for some reason the following SCSS var must be a CSS var.
15+
$box-shadow-color-rgb-dark: var(--bs-black-rgb) !default;
16+
17+
@include color-mode(dark) {
18+
$box-shadow-color-rgba-dark: rgba(
19+
#{$box-shadow-color-rgb-dark},
20+
#{$box-shadow-alpha-dark}
21+
) !default;
22+
23+
// The following is supposed to only tweak the rgba value, but Bootstrap isn't
24+
// setup to allow this. So we'll need to ensure that non-rgba values stay in
25+
// sync with Bootstraps.
26+
27+
--bs-box-shadow: 0 0.5rem 1rem #{$box-shadow-color-rgba-dark};
28+
--bs-box-shadow-sm: 0 0.125rem 0.25rem #{$box-shadow-color-rgba-dark};
29+
--bs-box-shadow-lg: 0 1rem 3rem #{$box-shadow-color-rgba-dark};
30+
--bs-box-shadow-inset: inset 0 1px 2px #{$box-shadow-color-rgba-dark};
31+
}

assets/scss/_registry.scss

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,3 @@
3939
.registry-entry {
4040
@extend .shadow;
4141
}
42-
43-
#searchForm .btn.btn-outline-success,
44-
.btn-outline-danger,
45-
.btn-outline-secondary {
46-
&:hover {
47-
color: var(--bs-white);
48-
}
49-
}
50-
51-
@include color-mode(dark) {
52-
@media (prefers-color-scheme: dark) {
53-
.border-default {
54-
border-color: #a3a3a3;
55-
}
56-
.card.registry-entry {
57-
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8) !important;
58-
}
59-
.card.registry-entry,
60-
.list-group > .list-group-item {
61-
background-color: #262d2c;
62-
}
63-
}
64-
}

assets/scss/_styles_project.scss

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
@import 'registry';
55
@import 'tabs';
66
@import 'external_link';
7+
@import 'dark-adjustments';
78
@import 'td/color-adjustments-dark';
89
@import 'td/code-dark';
910
@import 'td/gcs-search-dark';
@@ -214,11 +215,6 @@
214215
@extend .td-max-width-on-larger-screens;
215216
}
216217

217-
// Ensure OTel icons display correctly in dark mode
218-
[data-bs-theme='dark'] .otel-icon {
219-
filter: brightness(0) invert(1);
220-
}
221-
222218
.td-blog.otel-with-contributions-from {
223219
.td-content {
224220
.td-byline {

layouts/_partials/ecosystem/registry/entry.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
{{ $package = merge .package (index $remoteRegistries .package.registry) -}}
6666
{{ $package = merge $package (dict "type" .registryType) -}}
6767
{{ end -}}
68-
{{ $highlightStyle := "border-default" -}}
68+
{{ $highlightStyle := "" -}}
6969
{{ if $isNew -}}
7070
{{ $highlightStyle = "border-info" -}}
7171
{{ end -}}
@@ -117,22 +117,22 @@ <h4 class="card-title mb-0 d-flex flex-row">
117117
<span class="badge rounded-pill text-bg-info"><i class="fa-regular fa-star"></i> new</span>
118118
{{ end -}}
119119
{{ if $isNative -}}
120-
<a href="{{ $registryUrl }}/?flag=native" class="badge rounded-pill text-bg-success text-white" title="Click to filter by native flag">
120+
<a href="{{ $registryUrl }}/?flag=native" class="badge rounded-pill text-bg-success" title="Click to filter by native flag">
121121
<i class="fa-solid fa-puzzle-piece"></i> native</a>
122122
{{ end -}}
123123
{{ if $isFirstParty -}}
124-
<a href="{{ $registryUrl }}/?flag=first_party" class="badge rounded-pill text-bg-success text-white" title="Click to filter by first party flag">
124+
<a href="{{ $registryUrl }}/?flag=first_party" class="badge rounded-pill text-bg-success" title="Click to filter by first party flag">
125125
<i class="fa-solid fa-heart"></i> first party integration</a>
126126
{{ end -}}
127127
{{ if $usedInDemo -}}
128-
<span class="badge rounded-pill text-bg-secondary text-white" title="This package is used in the OpenTelemetry Demo!"><i class="fa-solid fa-shapes"></i> OTel Demo</span>
128+
<span class="badge rounded-pill text-bg-secondary" title="This package is used in the OpenTelemetry Demo!"><i class="fa-solid fa-shapes"></i> OTel Demo</span>
129129
{{ end -}}
130130
{{ if $deprecated -}}
131-
<a href="{{ $registryUrl }}/?flag=deprecated" class="badge rounded-pill text-bg-danger text-white" title="Click to filter by deprecated flag">
131+
<a href="{{ $registryUrl }}/?flag=deprecated" class="badge rounded-pill text-bg-danger" title="Click to filter by deprecated flag">
132132
<i class="fa-solid fa-ban"></i> deprecated</a>
133133
{{ end -}}
134134
{{ if .cncfProjectLevel -}}
135-
<span class="badge rounded-pill text-bg-primary text-white" title="CNCF {{ .cncfProjectLevel}} Project">
135+
<span class="badge rounded-pill text-bg-primary" title="CNCF {{ .cncfProjectLevel}} Project">
136136
<img alt="CNCF" style="display: inline-block; width: 14px; height: 14px; border: none; margin:0px; padding: 0; vertical-align:middle" src="/img/cncf-icon-white.svg"> {{ .cncfProjectLevel }}
137137
</span>
138138
{{ end -}}
@@ -166,13 +166,11 @@ <h4 class="card-title mb-0 d-flex flex-row">
166166
{{- .description | markdownify -}}
167167
</div>
168168

169-
<!-- New Tags section -->
170169
<div class="tags mb-2">
171170
{{ if .tags }}
172171
<div>
173172
{{ range .tags }}
174-
{{ $tag := . }} <!-- Store the tag in a variable -->
175-
<a href="{{ $registryUrl }}/?s={{ $tag | urlize }}" class="badge bg-light me-1">{{ $tag }}</a>
173+
<a href="{{ $registryUrl }}/?s={{ . | urlize }}" class="badge text-bg-primary me-1">{{ . }}</a>
176174
{{ end }}
177175
</div>
178176
{{ end }}

0 commit comments

Comments
 (0)