Initial commit

This commit is contained in:
Lncvrt committed 2026-10-01 13:37:17 -07:00
commit 5bdfd99e89
49 files changed
+635

No files matched your search

@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

@@ -0,0 +1 @@
{"images":[{"size":"1024x1024","filename":"1024.png","expected-size":"1024","idiom":"ios-marketing","folder":"Assets.xcassets/AppIcon.appiconset/","scale":"1x"},{"size":"60x60","expected-size":"180","filename":"180.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"40x40","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"60x60","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"57x57","expected-size":"57","filename":"57.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"87","filename":"87.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"57x57","expected-size":"114","filename":"114.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"60","filename":"60.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"72x72","expected-size":"72","filename":"72.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"76x76","expected-size":"152","filename":"152.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"50x50","expected-size":"100","filename":"100.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"76x76","expected-size":"76","filename":"76.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"50x50","expected-size":"50","filename":"50.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"72x72","expected-size":"144","filename":"144.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"40x40","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"83.5x83.5","expected-size":"167","filename":"167.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"20x20","expected-size":"20","filename":"20.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"idiom":"watch","filename":"172.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"38mm","scale":"2x","size":"86x86","expected-size":"172","role":"quickLook"},{"idiom":"watch","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"38mm","scale":"2x","size":"40x40","expected-size":"80","role":"appLauncher"},{"idiom":"watch","filename":"88.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"40mm","scale":"2x","size":"44x44","expected-size":"88","role":"appLauncher"},{"idiom":"watch","filename":"102.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"45mm","scale":"2x","size":"51x51","expected-size":"102","role":"appLauncher"},{"idiom":"watch","filename":"108.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"49mm","scale":"2x","size":"54x54","expected-size":"108","role":"appLauncher"},{"idiom":"watch","filename":"92.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"41mm","scale":"2x","size":"46x46","expected-size":"92","role":"appLauncher"},{"idiom":"watch","filename":"100.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"44mm","scale":"2x","size":"50x50","expected-size":"100","role":"appLauncher"},{"idiom":"watch","filename":"196.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"42mm","scale":"2x","size":"98x98","expected-size":"196","role":"quickLook"},{"idiom":"watch","filename":"234.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"45mm","scale":"2x","size":"117x117","expected-size":"234","role":"quickLook"},{"idiom":"watch","filename":"258.png","folder":"Line truncated
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
+222
View File
@@ -0,0 +1,222 @@
//
// ContentView.swift
// Name a Color!
//
// Created by Travis Harbin on 8/30/26.
//
import SwiftUI
#if os(macOS)
import AppKit
#else
import UIKit
#endif
struct Item: Codable, Identifiable {
let id: Int
let name: String
let color: String
let timestamp: Int
}
struct WarningAlertModel: Identifiable {
let id = UUID()
let title: String
let message: String
}
extension Color {
init(hex: String) {
let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
let value = UInt64(hex, radix: 16) ?? 0
self.init(
red: Double((value >> 16) & 0xFF) / 255,
green: Double((value >> 8) & 0xFF) / 255,
blue: Double(value & 0xFF) / 255
)
}
//ai func
func toHex() -> String? {
#if canImport(UIKit)
let color = UIColor(self)
guard let color = color.cgColor.converted(
to: CGColorSpace(name: CGColorSpace.sRGB)!,
intent: .defaultIntent,
options: nil
) else {
return nil
}
let components = color.components ?? []
guard components.count >= 3 else {
return nil
}
let r = Int(round(components[0] * 255))
let g = Int(round(components[1] * 255))
let b = Int(round(components[2] * 255))
return String(format: "%02X%02X%02X", r, g, b)
#elseif canImport(AppKit)
let color = NSColor(self)
guard let color = color.usingColorSpace(.sRGB) else {
return nil
}
let r = Int(round(color.redComponent * 255))
let g = Int(round(color.greenComponent * 255))
let b = Int(round(color.blueComponent * 255))
return String(format: "%02X%02X%02X", r, g, b)
#endif
}
}
extension String {
func base64Decoded() -> String? {
guard let data = Data(base64Encoded: self) else { return nil }
return String(data: data, encoding: .utf8)
}
}
struct ContentView: View {
@State private var items: [Item] = []
@State private var total: Int = 255 * 255 * 255
@State private var selectedColor: Color = Color.blue
@State private var selectedName: String = ""
@State private var activeWarning: WarningAlertModel?
func updateItems() async throws {
let url = URL(string: "https://nameacolor.lncvrt.xyz/get.php")!
let (data, _) = try await URLSession.shared.data(from: url)
items = try JSONDecoder().decode([Item].self, from: data)
}
var body: some View {
VStack {
HStack {
Spacer()
Text("Name a Color!")
.font(.title)
.fontWeight(.bold)
Spacer()
Button {
items = []
Task {
do {
try await updateItems()
} catch {
print("failed to fetch items:", error)
}
}
} label: {
Image(systemName: "arrow.clockwise")
.font(.system(size: 14, weight: .semibold))
.frame(width: 32, height: 32)
}
.buttonStyle(.plain)
.background(.gray.opacity(0.12))
.clipShape(Circle())
.help("Refresh")
}
Text("\(items.count.formatted())/\(total.formatted()) colors named (\((total - items.count).formatted()) left)")
Text("Name your own color!")
.font(.title2)
.fontWeight(.bold)
.padding(.top)
HStack {
ColorPicker("Color", selection: $selectedColor, supportsOpacity: true)
.padding()
TextField("Name", text: $selectedName)
Button("Name it!") {
Task {
let url = URL(string: "https://nameacolor.lncvrt.xyz/upload.php?color=" + (selectedColor.toHex() ?? "FFFFFF") + "&name=" + selectedName)!
let (data, _) = try await URLSession.shared.data(from: url)
let response = String(data: data, encoding: .utf8)
if response == "-1" {
activeWarning = WarningAlertModel(title: "Failed to upload color", message: "Invalid color")
} else if response == "-2" {
activeWarning = WarningAlertModel(title: "Failed to upload color", message: "Name too short")
} else if response == "-3" {
activeWarning = WarningAlertModel(title: "Failed to upload color", message: "Name too long")
} else if response == "-4" {
activeWarning = WarningAlertModel(title: "Failed to upload color", message: "Color already taken")
} else if response == "-5" {
activeWarning = WarningAlertModel(title: "Failed to upload color", message: "Name already taken")
} else {
activeWarning = WarningAlertModel(title: "uploaded", message: "kaboom")
}
}
}
.buttonStyle(.bordered)
}
Text("Colors that were named")
.font(.title2)
.fontWeight(.bold)
.padding(.top)
ScrollView {
LazyVGrid(
columns: [GridItem(.adaptive(minimum: 210), spacing: 14)],
spacing: 14
) {
ForEach(items) { item in
VStack(alignment: .leading, spacing: 12) {
Color(hex: item.color)
.frame(height: 100)
.clipShape(RoundedRectangle(cornerRadius: 12))
VStack(alignment: .leading, spacing: 4) {
Text(item.name.base64Decoded() ?? "???")
.font(.headline)
.foregroundStyle(.primary)
Text("#" + item.color.uppercased())
.font(.system(.subheadline, design: .monospaced))
.foregroundStyle(.secondary)
.textSelection(.enabled)
}
}
.padding(12)
.frame(maxWidth: .infinity, alignment: .leading)
.background(.gray.opacity(0.12))
.clipShape(RoundedRectangle(cornerRadius: 16))
.overlay {
RoundedRectangle(cornerRadius: 16)
.stroke(.primary.opacity(0.06), lineWidth: 1)
}
}
}
.padding()
.task {
do {
try await updateItems()
} catch {
print("failed to fetch items:", error)
}
}
}
}
.alert(item: $activeWarning) { warning in
Alert(
title: Text(warning.title),
message: Text(warning.message),
dismissButton: .default(Text("OK"))
)
}
.padding()
}
}
#Preview {
ContentView()
}
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
+17
View File
@@ -0,0 +1,17 @@
//
// Name_a_Color_App.swift
// Name a Color!
//
// Created by Travis Harbin on 8/30/26.
//
import SwiftUI
@main
struct Name_a_Color_App: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}