seedkin

Styles / Noggin Preview

Meet the Noggins.

The Grid's people came up last and in every shade: curls and locs, buzz cuts and buns, glasses, beards and headscarves, and no two noggins quite alike. Give one some text and it draws the same person every time, on any machine, with nothing stored. Type anything to meet yours, or pick your own skin tone in the options.

    Below 40px it switches to a simpler version of the same Noggin.

    Download

    Options

    Same options, more seeds

    Use it

    Install

    npm install seedkin
    pnpm add seedkin
    yarn add seedkin
    bun add seedkin

    Draw one

    import { noggin, nogginDataUri } from 'seedkin/noggin';
    
    // An SVG string, to inline
    const svg = noggin(user.id);
    
    // A data: URI, for an img src or CSS url()
    const src = nogginDataUri(user.id, { size: 40 });
    import { nogginDataUri } from 'seedkin/noggin';
    
    export function Avatar({ id, size = 40 }) {
      return <img src={nogginDataUri(id, { size, title: null })} alt="" width={size} height={size} />;
    }
    <img data-seed="ada" alt="" width="48" height="48" />
    
    <script type="module">
      import { nogginDataUri } from 'https://cdn.jsdelivr.net/npm/seedkin@2/dist/styles/noggin/index.js';
    
      for (const img of document.querySelectorAll('img[data-seed]')) {
        img.src = nogginDataUri(img.dataset.seed, { size: img.width, title: null });
      }
    </script>
    import { noggin } from 'seedkin/noggin';
    
    // GET /avatar/:id, as an image any page can use
    export async function GET(_request, { params }) {
      const { id } = await params;
      return new Response(noggin(id, { size: 96 }), {
        headers: { 'Content-Type': 'image/svg+xml', 'Cache-Control': 'public, max-age=31536000, immutable' },
      });
    }

    Details

    Entry point
    seedkin/noggin
    Status
    Preview A seed's avatar can change in a minor version until it's stable. What Preview means
    Size
    8.0 kB gzipped, with no dependencies
    Parts
    7 skin tones, 12 hairstyles, 7 hair colours, 5 eyes, 4 mouths, 2 kinds of facial hair, 2 kinds of eyewear, 4 kinds of headwear and earrings, 6 palettes, on 4 cell shapes
    Small sizes
    A simpler 9x9 person below 40px, from the same traits
    Licence
    MIT, art included

    Noggin in the docs

    Options

    Options for noggin()
    OptionTypeDefaultWhat it does
    shape'square' | 'circle' | 'triangle' | 'diamond'picked by the seedCell shape.
    palettenumber | Palettepicked by the seedIndex into Noggin's PALETTES (its outfits), or a palette object.
    sizenumber96Width and height in pixels.
    detail'auto' | 'full' | 'small''auto''small' is the simpler 9x9 person; 'auto' draws it below 40px.
    showGridboolean | 'auto''auto'Draw the empty grid cells; 'auto' draws them from 40px up.
    look'gapped' | 'flat' | 'inked' | 'soft' | 'soft-inked' | 'sticker''gapped'How the cells are drawn: apart, or merged into flat shapes. See Looks.
    frame'square' | 'rounded' | 'squircle' | 'circle''square'The outline of the background. Outside it the image is transparent.
    backgroundbooleantrueDraw the palette's background.
    titlestring | null'Person avatar'Accessible name. null marks the image decorative.
    skinnumberpicked by the seedIndex into SKIN_TONES, lightest first. Hair and outfit move to colours that stand out from it.