Skip to content

feat: NucleusIcons#25

Merged
Priva28 merged 5 commits into
mainfrom
nucleus-icons
Jun 5, 2026
Merged

feat: NucleusIcons#25
Priva28 merged 5 commits into
mainfrom
nucleus-icons

Conversation

@Priva28
Copy link
Copy Markdown
Contributor

@Priva28 Priva28 commented May 6, 2026

Summary

Adds icon tokens to nucleus. Source SVGs live in tokens/definitions/icons/{outline,regular,solid} (140-ish per variant, 141 unique icons total — most ship in all three variants, a handful are variant-specific). The build pipeline now emits per-platform icon outputs alongside the existing colors and fonts.

Almost all of it is auto-generated icon assets. Per icon, per variant we emit:

  • iOS: an .imageset directory with Contents.json + the SVG (≈ 832 files)
  • Android: a vector drawable XML (≈ 416 files)
  • Web: the raw SVG copy (≈ 416 files, only if build/ is tracked)

iOS

  • New NucleusIcons SPM library with Resources/Icons.xcassets (one .imageset per icon × variant, all template-rendered with vector preservation).
  • NucleusIcon is a String-rawValue enum where the raw value is the kebab-case icon name. .image(_:) and .uiImage(_:) return a SwiftUI Image? / UIImage? for a given Variant, returning nil if the icon doesn't ship in that variant. availableVariants exposes which variants exist per case.
  • API is intentionally minimal/raw for now.

Android

  • 416 vector drawables generated from the SVGs and dropped into android/nucleus/src/main/res/drawable/ with a nucleus_icon_ prefix.
  • NucleusIcons.kt is an enum class with nullable @DrawableRes fields per variant, plus drawableRes(variant) and @Composable painter(variant). We tint at the call site (Icon(painter, tint = …)) — drawables ship with a black placeholder fill.
  • Wrote a tiny SVG → VectorDrawable converter in tokens/formats/icons-android.ts. Most icons are pure paths, but gift.svg uses <rect>/<circle>/matrix transforms, so the converter handles those by flattening to path data.

Web

  • All SVGs copied to build/web/icons/{name}-{variant}.svg.
  • New build/web/nucleus-icons.json manifest indexed by icon name with both file paths and inlined SVG strings per variant.
  • package.json template updated to ship icons/*.

Base automatically changed from nucleusfonts to main May 26, 2026 20:01
Copy link
Copy Markdown
Collaborator

@jaidensiu jaidensiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you clarify somewhere briefly (in the README for now is fine) how these icons are used on each platform?

Comment thread android/nucleus/src/main/java/com/worldcoin/nucleus/tokens/NucleusFonts.kt Outdated
Comment thread ios/Sources/NucleusFonts/NucleusFont.swift Outdated
Copy link
Copy Markdown
Collaborator

@jaidensiu jaidensiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking comments, thanks for taking the lead on this!

import com.worldcoin.nucleus.R

/**
* A nucleus design-token icon.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Nucleus and design token (non-hyphenated)

import SwiftUI
import UIKit

/// A nucleus design-token icon.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Nucleus and design token

@Priva28 Priva28 merged commit a41da3b into main Jun 5, 2026
7 checks passed
@Priva28 Priva28 deleted the nucleus-icons branch June 5, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants