• 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/15/2025
Viewing readonly version of main branch: v9
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 treats the first word of firstPart as the top line and the rest as the bottom line (default: false)
  • yOffset - Vertical offset to apply to text (positive moves down, negative moves up, default: 0) Note: y-offset is now fixed at 20px
  • 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 two text lines with these key characteristics:

  • The text is always centered at a fixed X position of 112px (per requirement)
  • Font sizes are automatically calculated to give both lines equal visual width
  • A fixed y-offset of 20px is applied to all text positions for optimal spacing
  • The vertical spacing between lines is proportional to the font sizes with a factor of -0.25

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 Logo

/api?firstPart=AWESOME&lastPart=LOGO

Styled Logo

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

Logo with Emoji

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

Single Line Logo

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

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. Equal Visual Width: The algorithm calculates optimal font sizes to make both lines appear to have equal width.

  3. Fixed Y Offset: A y-offset of 20px is always applied for optimal vertical positioning.

  4. Vertical Spacing: 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.

  6. Single Line Mode: Splits the text at the first space, treating the first word as the top line and the rest as the bottom line with different colors.

Browser Integration

To embed the logo in a webpage:

<img src="https://dcm31--fd40123818b311f09f78569c3dd06744.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--fd40123818b311f09f78569c3dd06744.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; }

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 Y offset is fixed at 20px and cannot be changed
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.