chessbaseLinux/iosApp/ChessPenguin/Theme.swift
2026-12-01 00:56:28 +03:00

81 lines
3.3 KiB
Swift

import Foundation
import SwiftUI
extension Color {
init(rgb: UInt32) {
self.init(
red: Double((rgb >> 16) & 0xFF) / 255,
green: Double((rgb >> 8) & 0xFF) / 255,
blue: Double(rgb & 0xFF) / 255
)
}
}
enum Theme {
static let background = Color(rgb: 0x161718)
static let containerLow = Color(rgb: 0x1F2022)
static let container = Color(rgb: 0x232427)
static let containerHigh = Color(rgb: 0x2A2C2F)
static let onSurface = Color(rgb: 0xE8E8E8)
static let onSurfaceVariant = Color(rgb: 0xA3A7AD)
static let outline = Color(rgb: 0x4A4D52)
static let outlineVariant = Color(rgb: 0x2E3033)
static let primary = Color(rgb: 0x62AEE6)
static let primaryContainer = Color(rgb: 0x1A4566)
static let error = Color(rgb: 0xF28B82)
static let pgnBadge = Color(rgb: 0x384660)
static let pgnBadgeText = Color(rgb: 0x89B4FA)
static let currentMove = Color(rgb: 0x005C80)
static let comment = Color(rgb: 0x9EC4E0)
static let boardLight = Color(rgb: 0xFFFFDD)
static let boardDark = Color(rgb: 0x86A666)
static let lastMove = Color(rgb: 0x9BC700).opacity(0.41)
}
enum L10n {
static let appName = String(localized: "app_name")
static let files = String(localized: "files")
static let classics = String(localized: "classic_games")
static let reading = String(localized: "reading")
static let retry = String(localized: "retry")
static let openFailed = String(localized: "open_failed")
static let gameFailed = String(localized: "game_failed")
static let emptyDatabase = String(localized: "empty_database")
static let previousGame = String(localized: "previous_game")
static let nextGame = String(localized: "next_game")
static let flip = String(localized: "flip")
static let moveBack = String(localized: "move_back")
static let moveForward = String(localized: "move_forward")
static let toStart = String(localized: "to_start")
static let toEnd = String(localized: "to_end")
static let nextMoves = String(localized: "next_moves")
static let white = String(localized: "white")
static let black = String(localized: "black")
static let boardStart = String(localized: "board_start")
static let checkmate = String(localized: "checkmate")
static let stalemate = String(localized: "stalemate")
static let currentMove = String(localized: "current_move")
static let moveBackHint = String(localized: "move_back_hint")
static let moveForwardHint = String(localized: "move_forward_hint")
static func games(_ count: Int) -> String {
String.localizedStringWithFormat(NSLocalizedString("games_count", comment: "Number of games"), count)
}
static func gameOf(_ current: Int, _ total: Int) -> String {
String(format: String(localized: "game_of"), current, total)
}
static func boardAfter(_ move: String) -> String {
String(format: String(localized: "board_after"), move)
}
static func resultLine(_ result: String) -> String {
switch result {
case "1-0": return "1-0 · \(String(localized: "white_won"))"
case "0-1": return "0-1 · \(String(localized: "black_won"))"
case "1/2-1/2": return "½-½ · \(String(localized: "draw"))"
default: return ""
}
}
}