• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
dcm31

dcm31

logoWorkshopOpenMoji

Project created from val URLs
Public
Like
logoWorkshopOpenMoji
Home
Code
15
API_DOCS.md
ColorPicker.tsx
ColorUtils.tsx
EmojiColorHandler.tsx
EmojiUtils.tsx
FontData.tsx
LogoGenerator.tsx
LogoPreview.tsx
SvgHostClient.tsx
TextEditor.tsx
TextSizing.tsx
H
api.tsx
H
index.tsx
zLogoGenerator.tsx
zTextSizing.tsx
Branches
5
Pull requests
5
Remixes
1
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
API_DOCS.md
Code
/
API_DOCS.md
Search
4/16/2025
Viewing readonly version of main branch: v10
View latest version
API_DOCS.md

Logo Workshop OpenMoji API Documentation

The Logo Workshop API allows you to generate custom logo SVGs with OpenMoji emoji integration.

Endpoint

GET /api

Parameters

Required Parameters

  • firstPart - Text for the top line (or full text in single line mode)
  • lastPart - Text for the bottom line (ignored in single line mode)

Optional Parameters

Text Styling

  • fontFamily - Font family to use (default: "Arial, sans-serif")
  • textColor - Hex color code for the top line text (default: "#000000")
  • accentColor - Hex color code for the bottom line text and border (default: "#ea5a47")
  • secondaryColor - Hex color code for the bottom accent strip (default: "#781e32")
  • bgColor - Hex color code for the background (default: "#ffffff")
  • boldTop - Whether top line should be bold (default: true, set to "false" to disable)
  • italicTop - Whether top line should be italic (default: false, set to "true" to enable)
  • boldBottom - Whether bottom line should be bold (default: true, set to "false" to disable)
  • italicBottom - Whether bottom line should be italic (default: false, set to "true" to enable)

Layout and Positioning

  • singleLine - Set to "true" to use single line mode, which splits text at the first space and colors the parts differently (default: false)
  • yOffset - Vertical offset to apply to text (positive moves down, negative moves up). Note: Fixed values are now used for optimal positioning
  • maxWidth - Maximum width for text in pixels. Note: Fixed values are now used for optimal sizing
  • emojiX - X position for emoji (default: 140)
  • emojiY - Y position for emoji (default: 13.5)
  • emojiScale - Scale factor for emoji (default: 0.71)

Special Features

  • emoji - Emoji character to include in the logo (uses OpenMoji SVG)
  • debug - Set to "true" to show guide lines for layout debugging (default: false)
  • format - Set to "json" to get a JSON response with SVG and metadata (default: direct SVG)

Text Positioning

The API uses an algorithm based on the logoAPI implementation to position the text lines with these key characteristics:

  • The text is always centered at a fixed X position of 112px
  • Different positioning logic for single-line and two-line modes:
    • Two-Line Mode: Fixed y-offset of 20px and maxWidth of 153px for optimal spacing. Font sizes are automatically calculated to give both lines equal visual width.
    • Single-Line Mode: Fixed y-offset of 17px and maxWidth of 175px for optimal positioning. Both parts of text are displayed with the same font size.
  • In single-line mode, the text is split at the first space, with the first word in the primary text color and the rest in the accent color, all displayed on a single visual line

Response Formats

SVG Response (default)

Returns an SVG image directly.

JSON Response (format=json)

Returns a JSON object with the following structure:

{ "success": true, "svg": "<svg>...</svg>", "meta": { "topFontSize": 40, "bottomFontSize": 30, "topY": 42, "bottomY": 80, "textXPosition": 112, "maxWidth": 153, "actualWidth": 220, "singleLineMode": false, "isBoldTop": true, "isItalicTop": false, "isBoldBottom": true, "isItalicBottom": false, "emoji": "πŸš€", "emojiCodepoint": "1f680", "emojiX": 140, "emojiY": 13.5, "emojiScale": 0.71, "yOffset": 20 } }

Examples

Basic Two-Line Logo

/api?firstPart=AWESOME&lastPart=LOGO

Styled Two-Line Logo

/api?firstPart=COOL&lastPart=PROJECT&fontFamily=Arial&textColor=%23ffffff&accentColor=%23ff0000&bgColor=%23000000

Single-Line Logo with Space (Splits into Two Colors)

/api?firstPart=PROJECT%20NAME&singleLine=true

Logo with Emoji

/api?firstPart=ROCKET&lastPart=LAUNCH&emoji=πŸš€

JSON Response

/api?firstPart=META&lastPart=DATA&format=json

Implementation Notes

The text positioning algorithm is shared between both the web interface and API for consistent results. Key aspects:

  1. Fixed X Position: Text is always centered at X=112px, as specified in project requirements.

  2. Mode-Specific Settings:

    • Two-line mode uses fixed positioning parameters (y-offset: 20px, maxWidth: 153px) for optimal alignment
    • Single-line mode uses fixed positioning parameters (y-offset: 17px, maxWidth: 175px) for optimal appearance
  3. Improved Single-Line Mode:

    • Properly splits text at the first space
    • First word appears in primary text color
    • Words after the space appear in accent color
    • Both parts of text have the same font size
    • All text appears on a single line (using SVG tspans)
  4. Vertical Spacing: For two-line mode, the spacing between lines is proportional to font sizes, ensuring proper visual balance.

  5. DOM vs Estimation: The web interface uses DOM measurements for precise text sizing, while the API uses a character-based estimation method that produces consistent results.

Browser Integration

To embed the logo in a webpage:

<img src="https://dcm31--b0fe0371a0674b288e60ec112f756087.web.val.run/api?firstPart=AWESOME&lastPart=LOGO" alt="Logo" />

For dynamic logo generation in JavaScript:

async function getLogo(firstPart, lastPart, emoji) { const url = `https://dcm31--b0fe0371a0674b288e60ec112f756087.web.val.run/api?firstPart=${encodeURIComponent(firstPart)}&lastPart=${encodeURIComponent(lastPart)}&emoji=${encodeURIComponent(emoji)}&format=json`; const response = await fetch(url); const data = await response.json(); // Use data.svg for the SVG content document.getElementById('logo-container').innerHTML = data.svg; }

For single-line mode with words in different colors:

async function getSingleLineLogo(text, emoji) { // Make sure text has at least one space to trigger the color split const url = `https://dcm31--b0fe0371a0674b288e60ec112f756087.web.val.run/api?firstPart=${encodeURIComponent(text)}&singleLine=true&emoji=${encodeURIComponent(emoji)}&format=json`; const response = await fetch(url); const data = await response.json(); return data.svg; }

Limitations

  • The API does not support custom sizing of the overall logo (fixed at 301x113.266)
  • All text is automatically converted to uppercase
  • Only OpenMoji emoji set is supported
  • Text X position is fixed at 112px and cannot be changed
  • Text positioning parameters are fixed for optimal appearance in both modes
  • Single-line mode requires at least one space in the text to trigger the color split effect
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
Β© 2025 Val Town, Inc.