Appearance
Appearance
IMPORTANT
Never rely on color alone to convey relevant information. Many people will not perceive certain colors, so give them other affordances to understand the meaning of a given alert.
Alerts support Pastel attributes. Buttons accept Color and Variant attributes. Cards accept Pastel, Variant, Neutral and Raised attributes.
<Card solid red title='🌈' />primary | secondary | destructive) orblue | red | green | yellow) ordefault) for surfacessolid | ghost | outline)<script setup>
import { color } from "~/composables/color.ts";
</script>
<template>
<div v-bind="color({}, ['primary', 'solid', 'interactive', 'raised'])()" />
</template>color accepts two parameters. The first is your props object, the second is a list of defaults.
In this case, if the user of your component doesn't specify any color, it will be 'primary'. Since the user cannot specify the variant, it will always be 'default'.
<script setup>
import { type ColorProps, color } from "~/composables/colors.ts";
const props = defineProps<{
...
} & ColorProps>()
</script>
<template>
<div v-bind="color(props, ['primary', 'solid'])()" />
</template>Keep most of the screen neutral. Secondary surfaces indicate actionability. Use them sparingly. Primary and destructive surfaces immediately catch the eye. Use them only once or twice per screen.
Use neutral colors for non-interactive surfaces
Only use for at most one call-to-action on a screen
Use for interactive items and non-permanent surfaces such as menus and modals
Use for dangerous actions
Use Blue, Red, Purple, Green, Yellow for user-defined tags and for friendly messages such as Alerts
You can de-emphasize interactive elements by hiding their background and/or outline.
Solid (default), Ghost, Outline:
Use raised surfaces sparingly, about ¼ of the screen. Only use raised surfaces to highlight one area of a component over others. Good examples are asides such as the sidebar or info-boxes.
Space out interactive surfaces.
| neutral |
|---|
| secondary |
| primary |
| (normal) | interactive | disabled | pressed |
|---|
The color palette consists of Blues, Reds, Grays, Beiges, as well as pastel blue/red/green/yellow.
fw-blue-010 - 100 - 400..900
fw-red-010 - 100 - 400..900
fw-gray-100..800 - 850 - 900 - 950 - 960 - 970
fw-beige-100..400
fw-pastel-blue-1..4
fw-pastel-red-1..4
fw-pastel-purple-1..4
fw-pastel-green-1..4
fw-pastel-yellow-1..4
In addition, we have a single shade of orange used for secondary indicators such as active tabs: fw-secondary
Many browsers automatically turn on "night mode" to lower the light emission of the screen. Users can override the browser theme in their settings menu.
In both "dark mode" and "light mode", the colors must provide adequate contrast and consistency.
Read more about style modules in the corresponding vue docs.
For testing purposes and side-by-side comparisons, you can add the classes force-dark-theme and force-light-theme.
We use semantic color variables that can mean a different shade depending on the currently chosen theme
For each semantic color, we set a foreground and a background. In addition, we need to check context: A button should have a stronger shade when the mouse is hovering over it. When a surface is raised over another surface, it should have a stronger shade, too.
Variants:
ghost (default for most things except buttons)
affects text color but leaves the border and background transparent. Make sure to provide a surface beneath with adequate contrast.
outline
affects text color and border and leaves the background transparent Make sure to provide a surface beneath with adequate contrast.
solid (default for buttons)
affects text color, border color and background color
Variants can optionally be made interactive and/or raised:
no alteration (default)
raised
affects text color, border color and background color
interactive
user interaction affects text color, border color and background color
- can be disabled
- can be active
- can be exact-active
- can be hovering
interactive-raised
combine
raisedandinteractive
-> Example: #interactive-and-or-raised
All colors are defined in front/src/style/colors.scss.
Its structure is as follows:
Defining all funkwhale color values
both for light and dark theme, and both normal and raised:
(for all elements not managed by vitepress)
For example, you want to make all blue hues more cyan-ish or mute all reds.
In funkwhale components, we use semantic color names such as primary, destructive, default (neutral). Now, you find, for example, that a secondary button has low contrast in light mode, and you decide to alter the text color.
.secondary under theme-light.--color: var(--fw-gray-700); and --background-color: var(--fw-gray-200);, and you change --color to var(--fw-gray-900).For example, you want to add visible lines around ghost links and buttons when the user hovers over them.
.ghost.border-color: var(--hover-border-color); under &:hover to make the outline on interactive items visible on hover.Make sure that:
Here is the meaning the styles should convey: