Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Fix dark theme inconsistencies (#4808)

Olga Bulat19bce7c1abf4
diff --git a/frontend/src/app.vue b/frontend/src/app.vue
index ea8fc011f..19d5c0250 100644
--- a/frontend/src/app.vue
+++ b/frontend/src/app.vue
@@ -2,8 +2,8 @@
import {
computed,
onMounted,
- useLocaleHead,
useHead,
+ useLocaleHead,
useRuntimeConfig,
} from "#imports"
@@ -15,6 +15,8 @@ import { useDarkMode } from "~/composables/use-dark-mode"
import { meta as commonMeta } from "~/constants/meta"
+import { favicons } from "~/constants/favicons"
+
import VSkipToContentButton from "~/components/VSkipToContentButton.vue"
const { updateBreakpoint } = useLayout()
@@ -39,29 +41,6 @@ const head = useLocaleHead({
addSeoAttributes: true,
})
-const favicons = [
- // SVG favicon
- {
- rel: "icon",
- href: "/favicon.ico",
- },
- {
- rel: "icon",
- href: "/openverse-logo.svg",
- },
- // SVG favicon for Safari
- {
- rel: "mask-icon",
- href: "/opvenverse-logo.svg",
- color: "#30272E",
- },
- // Fallback iPhone Icon
- {
- rel: "apple-touch-icon",
- href: "/openverse-logo-180.png",
- },
-]
-
useHead({
bodyAttrs: { class: darkMode.cssClass },
title: "Openly Licensed Images, Audio and More | Openverse",
diff --git a/frontend/src/components/TableSortIcon.vue b/frontend/src/components/TableSortIcon.vue
index 2ed89da64..7fd5cb51f 100644
--- a/frontend/src/components/TableSortIcon.vue
+++ b/frontend/src/components/TableSortIcon.vue
@@ -13,7 +13,10 @@ export default defineComponent({
</script>
<template>
- <div class="flex flex-col" :class="[active ? 'text-default' : 'text-gray']">
+ <div
+ class="flex flex-col"
+ :class="[active ? 'text-default' : 'text-disabled']"
+ >
<svg
width="12"
height="6"
diff --git a/frontend/src/components/VAudioTrack/VWaveform.vue b/frontend/src/components/VAudioTrack/VWaveform.vue
index 14841befc..77d74287a 100644
--- a/frontend/src/components/VAudioTrack/VWaveform.vue
+++ b/frontend/src/components/VAudioTrack/VWaveform.vue
@@ -494,7 +494,7 @@ const seekTimeLeft = computed(() => ({
.waveform {
--v-background-color: var(
--waveform-background-color,
- theme("colors.gray.1")
+ theme("backgroundColor.default")
);
}
diff --git a/frontend/src/components/VButton.vue b/frontend/src/components/VButton.vue
index 0a96a288a..a86462152 100644
--- a/frontend/src/components/VButton.vue
+++ b/frontend/src/components/VButton.vue
@@ -263,7 +263,7 @@ a.button {
@apply border-bg-ring bg-default text-default hover:border-transparent-hover hover:focus-visible:border-tx;
}
.bordered-white-pressed {
- @apply border-tx bg-tertiary text-over-dark hover:border-gray-11 hover:bg-tertiary-hover hover:focus-visible:border-tx;
+ @apply border-tx bg-tertiary text-over-dark hover:border-hover hover:bg-tertiary-hover hover:focus-visible:border-tx;
}
.bordered-gray {
@apply border-default bg-default text-default hover:border-hover focus-visible:border-tx hover:focus-visible:border-tx;
@@ -278,7 +278,7 @@ a.button {
@apply border-tx bg-tx text-default hover:bg-secondary-hover hover:text-over-dark;
}
.transparent-dark-pressed {
- @apply border-tx bg-tertiary text-over-dark hover:border-gray-11;
+ @apply border-tx bg-tertiary text-over-dark hover:border-hover;
}
.icon-only {
diff --git a/frontend/src/components/VHeader/VSearchBar/VSearchButton.vue b/frontend/src/components/VHeader/VSearchBar/VSearchButton.vue
index ed53870bd..3f560e2c1 100644
--- a/frontend/src/components/VHeader/VSearchBar/VSearchButton.vue
+++ b/frontend/src/components/VHeader/VSearchBar/VSearchButton.vue
@@ -30,6 +30,7 @@ const { doneHydrating } = useHydrating()
'border-tx bg-secondary hover:bg-primary': route === 'search',
'border-tx bg-primary text-over-dark hover:!bg-primary-hover':
route === 'home',
+ 'border-black': route === '404',
},
]"
>
diff --git a/frontend/src/components/VHeader/VSearchBar/VStandaloneSearchBar.vue b/frontend/src/components/VHeader/VSearchBar/VStandaloneSearchBar.vue
index 1abc2369b..15870af78 100644
--- a/frontend/src/components/VHeader/VSearchBar/VStandaloneSearchBar.vue
+++ b/frontend/src/components/VHeader/VSearchBar/VStandaloneSearchBar.vue
@@ -16,7 +16,7 @@ withDefaults(
/**
* Search bar should not have a focus box when a popover is open.
*/
- hasPopover: boolean
+ hasPopover?: boolean
}>(),
{
route: "home",
diff --git a/frontend/src/components/VModal/VModalContent.vue b/frontend/src/components/VModal/VModalContent.vue
index 488e626e3..70fd5cebe 100644
--- a/frontend/src/components/VModal/VModalContent.vue
+++ b/frontend/src/components/VModal/VModalContent.vue
@@ -179,25 +179,30 @@ defineExpose({
</header>
<div
- class="modal-content flex w-full flex-grow flex-col"
- :class="{
- 'text-left align-bottom md:rounded-se-lg md:rounded-ss-lg':
- variant === 'default',
- 'w-auto rounded': variant === 'centered',
- 'mt-auto w-full rounded-se-lg rounded-ss-lg bg-overlay':
- variant === 'fit-content',
- 'flex w-full flex-col justify-between px-6 pb-10':
- variant === 'full',
- 'overflow-y-hidden rounded-se-lg rounded-ss-lg':
- variant === 'two-thirds',
- 'h-full': variant === 'mobile-input',
- 'bg-black text-default': mode === 'dark',
- 'bg-overlay text-default': mode === 'light',
- 'fallback-padding':
- variant === 'fit-content' ||
- variant === 'two-thirds' ||
- variant === 'mobile-input',
- }"
+ class="modal-content flex w-full flex-grow flex-col text-default"
+ :class="[
+ {
+ 'text-left align-bottom md:rounded-se-lg md:rounded-ss-lg':
+ variant === 'default',
+ 'w-auto rounded': variant === 'centered',
+ 'mt-auto w-full rounded-se-lg rounded-ss-lg bg-overlay':
+ variant === 'fit-content',
+ 'flex w-full flex-col justify-between px-6 pb-10':
+ variant === 'full',
+ 'overflow-y-hidden rounded-se-lg rounded-ss-lg':
+ variant === 'two-thirds',
+ 'h-full': variant === 'mobile-input',
+ 'fallback-padding':
+ variant === 'fit-content' ||
+ variant === 'two-thirds' ||
+ variant === 'mobile-input',
+ },
+ variant === 'mobile-input'
+ ? 'bg-default'
+ : mode === 'dark'
+ ? 'bg-black'
+ : 'bg-overlay',
+ ]"
>
<slot />
</div>
diff --git a/frontend/src/components/VSkeleton/VAudioTrackSkeleton.vue b/frontend/src/components/VSkeleton/VAudioTrackSkeleton.vue
index 0ebf5f279..cacc6c08d 100644
--- a/frontend/src/components/VSkeleton/VAudioTrackSkeleton.vue
+++ b/frontend/src/components/VSkeleton/VAudioTrackSkeleton.vue
@@ -53,9 +53,9 @@ export default defineComponent({
animation: shimmer 3s infinite linear;
background: linear-gradient(
to right,
- theme("colors.gray.2") 4%,
- theme("colors.gray.3") 25%,
- theme("colors.gray.2") 36%
+ theme("backgroundColor.secondary") 4%,
+ theme("borderColor.default") 25%,
+ theme("backgroundColor.secondary") 36%
);
background-size: 1000px 100%;
}
diff --git a/frontend/src/components/VSkeleton/VBone.vue b/frontend/src/components/VSkeleton/VBone.vue
index 2f66194c9..2f1932a88 100644
--- a/frontend/src/components/VSkeleton/VBone.vue
+++ b/frontend/src/components/VSkeleton/VBone.vue
@@ -25,9 +25,9 @@ export default defineComponent({
animation: shimmer 3s infinite linear;
background: linear-gradient(
to right,
- theme("colors.gray.2") 4%,
- theme("colors.gray.3") 25%,
- theme("colors.gray.2") 36%
+ theme("backgroundColor.secondary") 4%,
+ theme("borderColor.default") 25%,
+ theme("backgroundColor.secondary") 36%
);
background-size: 1000px 100%;
}
diff --git a/frontend/src/constants/favicons.ts b/frontend/src/constants/favicons.ts
new file mode 100644
index 000000000..92bc60b2a
--- /dev/null
+++ b/frontend/src/constants/favicons.ts
@@ -0,0 +1,22 @@
+export const favicons = [
+ // SVG favicon
+ {
+ rel: "icon",
+ href: "/favicon.ico",
+ },
+ {
+ rel: "icon",
+ href: "/openverse-logo.svg",
+ },
+ // SVG favicon for Safari
+ {
+ rel: "mask-icon",
+ href: "/opvenverse-logo.svg",
+ color: "#30272E",
+ },
+ // Fallback iPhone Icon
+ {
+ rel: "apple-touch-icon",
+ href: "/openverse-logo-180.png",
+ },
+]
diff --git a/frontend/src/error.vue b/frontend/src/error.vue
index ed8bdaacf..a8b37f7ad 100644
--- a/frontend/src/error.vue
+++ b/frontend/src/error.vue
@@ -1,26 +1,26 @@
<script setup lang="ts">
import {
onMounted,
+ useDarkMode,
useFeatureFlagStore,
+ useHead,
useLocaleHead,
useRoute,
+ useRuntimeConfig,
} from "#imports"
import { useLayout } from "~/composables/use-layout"
+import { meta as commonMeta } from "~/constants/meta"
+import { favicons } from "~/constants/favicons"
+
import VFourOhFour from "~/components/VFourOhFour.vue"
defineProps(["error"])
-const head = useLocaleHead({
- addDirAttribute: true,
- identifierAttribute: "id",
- addSeoAttributes: true,
-})
-
-const { updateBreakpoint } = useLayout()
-
const route = useRoute()
+const { updateBreakpoint } = useLayout()
+const config = useRuntimeConfig()
/**
* Update the breakpoint value in the cookie on mounted.
@@ -36,6 +36,37 @@ onMounted(() => {
const featureFlagStore = useFeatureFlagStore()
featureFlagStore.initFromQuery(route.query)
+
+const darkMode = useDarkMode()
+const head = useLocaleHead({
+ addDirAttribute: true,
+ identifierAttribute: "id",
+ addSeoAttributes: true,
+})
+
+useHead({
+ bodyAttrs: { class: darkMode.cssClass },
+ title: "Openly Licensed Images, Audio and More | Openverse",
+ meta: commonMeta,
+ link: [
+ ...favicons,
+ {
+ rel: "search",
+ type: "application/opensearchdescription+xml",
+ title: "Openverse",
+ href: "/opensearch.xml",
+ },
+ {
+ rel: "dns-prefetch",
+ href: config.public.apiUrl,
+ },
+ {
+ rel: "preconnect",
+ href: config.public.apiUrl,
+ crossorigin: "",
+ },
+ ],
+})
</script>
<template>