Skip to content
Color Menu preview
Rendered from the SwiftUI source on this page.

Color Menu

From syxUI — written for both platforms, not translated between them.

A color-label picker menu.

Navigation · SwiftUI · iOS 17

  • navigation
  • swiftui

The actual source

MenuColor.swift
// Color Menu · syxUI · https://syxui.dev/components/menu-color
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let mnBlue = Color(red: 0.0, green: 0.47, blue: 1.0)

func menuCard<C: View>(_ w: CGFloat, @ViewBuilder _ c: () -> C) -> some View {
    c().frame(width: w).background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: 14, style: .continuous)).overlay(RoundedRectangle(cornerRadius: 14, style: .continuous).stroke(Color.primary.opacity(0.07), lineWidth: 1)).shadow(color: .black.opacity(0.06), radius: 14, y: 5)
}

struct MenuColor: View { var body: some View { menuCard(220) { VStack(spacing: 10) { HStack { Text("Label Color").font(.system(size: 14, weight: .semibold)); Spacer() }; HStack(spacing: 12) { ForEach(Array([Color(red: 0.9, green: 0.24, blue: 0.28), Color(red: 0.98, green: 0.55, blue: 0.10), Color(red: 0.16, green: 0.66, blue: 0.40), mnBlue, Color(red: 0.55, green: 0.40, blue: 0.90)].enumerated()), id: \.offset) { i, c in Circle().fill(c).frame(width: 30, height: 30).overlay { if i == 3 { Image(systemName: "checkmark").font(.system(size: 13, weight: .bold)).foregroundStyle(.white) } } } } }.padding(14) } } }
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17