@blumepage/dicebear-flowers
v2.0.2
Published
Two generations of flower avatars: the original DiceBear style and a species-based v2 with project/conversation seeding.
Maintainers
Readme
@blumepage/dicebear-flowers
Two generations of flower avatars in one package:
- v1 — the original configurable DiceBear flower style.
- v2 — species-based crowns with two-level project/conversation seeding. It works both as a DiceBear style and as a standalone SVG API.
The package root remains v1 for backwards compatibility. Explicit
/v1 and /v2 entry points are available for new code.
Install
npm install @dicebear/core @blumepage/dicebear-flowersVersioned entry points
| Import | API |
| --- | --- |
| @blumepage/dicebear-flowers | v1, backwards-compatible default |
| @blumepage/dicebear-flowers/v1 | explicit v1 DiceBear style |
| @blumepage/dicebear-flowers/v2 | v2 DiceBear style and standalone renderers |
v1 with DiceBear
import { createAvatar } from '@dicebear/core';
import { style } from '@blumepage/dicebear-flowers';
// Equivalent: import { style } from '@blumepage/dicebear-flowers/v1';
const svg = createAvatar(style, { seed: 'rosie' }).toString();v2 with DiceBear
import { createAvatar } from '@dicebear/core';
import { style } from '@blumepage/dicebear-flowers/v2';
const svg = createAvatar(style, {
seed: 'conversation-1',
projectSeed: 'my-project',
species: ['rose', 'tulip'],
}).toString();DiceBear's seed drives the setting by default. Set projectSeed to
keep the same crown across different avatar seeds. Set
mode: ['project'] to render only the crown tile.
v2 standalone
import {
projectAvatar,
conversationAvatar,
} from '@blumepage/dicebear-flowers/v2';
const project = projectAvatar('my-project');
const convA = conversationAvatar('my-project', 'conversation-1');
const convB = conversationAvatar('my-project', 'conversation-2');
// convA and convB show the same flower in visibly different settings.The standalone v2 renderer has no runtime dependencies and returns pure, deterministic SVG strings.
v2 parameter model
Every tunable uses one of three shapes:
Choice<T>for enums:{ allow?: T[], deny?: T[] }. Ifallowis present, only those values are used (whitelist). Otherwise the full curated pool minusdenyis used (blacklist).Spanfor numbers:{ min?, max? }. Omitted sides keep the curated default;min === maxlocks the value.- plain
boolean | undefinedfor flags:undefinedmeans the seeded default.
conversationAvatar('proj', 'conv', {
crown: {
species: { allow: ['rose', 'tulip'] }, // only roses and tulips
twoTone: false,
},
setting: {
bgTone: { deny: ['bold'] }, // avoid the richest backgrounds
flowerCount: { allow: [1] }, // never bouquets
zoom: { min: 90, max: 110 },
},
});Crown params (from the project seed)
| Param | Shape | Notes |
| --- | --- | --- |
| species | Choice<SpeciesId> | 12 species, see below |
| petalColor | Choice<string> | hex without #; whitelist may contain custom colors |
| centerColor | Choice<string> | custom combos are luminance-guarded |
| centerStyle | Choice<'dot'\|'ring'\|'dotted'> | |
| petalCount | Span | clamped to per-species bounds |
| rotation | Span (0–359°) | |
| spread | Span (88–108 %) | petal size |
| twoTone | boolean? | variegated petals |
Setting params (from the conversation seed)
| Param | Shape | Notes |
| --- | --- | --- |
| stem / background | boolean? | default on |
| flowerCount | Choice<number> (1–3) | defaults to 25% single, 42% double, 33% triple |
| zoom | Span (70–140 %) | bouquet-only; singles stay centered at 100% |
| stemStyle | Choice<'straight'\|'bent'\|'wavy'> | |
| stemColor / leafColor | Choice<string> | default: greens matched to bg luminance |
| leafShape | Choice<'thin'\|'almond'\|'round'\|'strap'\|'twin'> | |
| leafCount | Choice<number> (0–2) | |
| leafSize | Span (60–120 %) | |
| leafAngle | Span (−45..45°) | |
| bgLightness | Choice<'light'\|'mid'> | filters the tone pool by lightness class; combines with bgTone |
| bgTone | Choice<BgTone> | see tones below |
| bgPattern | Choice<BgPattern> | solid bands wedges halo dots corner gradient rings checker |
| bgAngle | Span (0–179°) | pattern angle |
| bgCount | Choice<number> (1–6) | pattern repeats |
| bgColor | string[] | full base override; siblings derived, contrast-guarded |
Background tones
A background is one flat tone — a self-contained recipe with its own hue
source. The three companion tones (tint, soft, bold) each sample a
slice of one shared intensity curve (pale near-white → rich mid-tone);
the slices overlap, so the whole set sweeps continuously with no gap. That
continuity is what makes intensity look gradual across a grid instead of
jumping between "barely tinted" and "loud". The palette is all light and
mid by design — there are no dark tones.
Each tone belongs to one lightness class (light, mid), and
bgLightness filters the tone pool through that map — so "light only" is
one constraint, and it can't contradict a tone the way an independent mode
flag could. An explicit bgTone whitelist wins if the two conflict.
| Tone | Class | Recipe |
| --- | --- | --- |
| tint | light | companion hue, pale end of the intensity curve |
| wash | light | pale wash of the petal's own hue |
| beige | light | warm Blume neutral through pale sand |
| garden | light | curated scenic tone (sky, sage, cream, blush, mint, lilac, sand) |
| soft | mid | companion hue, middle of the intensity curve |
| bold | mid | companion hue, rich end (saturation-capped, never within 40° of the petal hue) |
Companion hues are hand-tuned per petal hue band (red→sage/teal, yellow→lavender/sky, blue→butter/peach, …). Quality guards apply everywhere: chartreuse mid-tones are pulled back to butter, mid-lightness magenta is desaturated, curated tones too close in hue to the petal are filtered out, and a contrast guard nudges the background luminance away from the flower until it reads. Default patterns favor solid, gradient, halo, corner, and dots; the busier wedges and checker patterns are only used when explicitly requested. The default palette keeps enough chroma to remain visibly distinct in compact list avatars.
Species
| Species | Look |
| --- | --- |
| daisy | many slim petals, dotted seed center |
| sunflower | two layered pointed-petal rings, big seed head |
| rose | top-down concentric rings (2–3), spiral/bud/whorl hearts |
| tulip | side-profile cup (connects to the stem), varied height/flare |
| poppy | broad overlapping petals, dark center with stamens |
| forgetmenot | five round petals, yellow eye |
| lily | long pointed petals with midribs |
| cosmos | wide notched petals |
| anemone | broad petals, big dark center ringed by stamens |
| dahlia | pom-pom of three pointed-petal rings |
| bellflower | side-profile bell with a scalloped mouth |
| marigold | dense ruffled rings of scalloped petals |
Lower-level API
import {
createCrown, // (projectSeed, CrownParams?) => CrownSpec
createSetting, // (crown, conversationSeed, SettingParams?) => SettingSpec
renderCrown, // (crown, { tile?, tileColor? }?) => svg
renderSetting, // (spec) => svg
} from '@blumepage/dicebear-flowers/v2';Preview panel
npm install
npm run preview:install
npm run preview # http://localhost:5180Switch between conversation and project modes, lock a project
seed to see one flower across many conversation settings, and switch the
avatar size (16–100 px). Every param is editable: enum chips cycle
neutral → allow → deny (matching the whitelist/blacklist semantics),
spans use min/max sliders, flags are default/on/off. State persists in
localStorage.
License
MIT
