Tetris/TetrisUI/Tetromino+Color.swift

42 lines
1.2 KiB
Swift

//
// Tetromino+Color.swift
// Tetris
//
// Created by Shadowfacts on 10/15/19.
// Copyright © 2019 Shadowfacts. All rights reserved.
//
import SwiftUI
import TetrisKit
fileprivate extension Color {
static let tetrominoAqua = Color(red: 0, green: 214/255, blue: 211/255)
static let tetrominoBlue = Color(red: 0, green: 79/255, blue: 214/255)
static let tetrominoOrange = Color(red: 255/255, green: 128/255, blue: 0)
static let tetrominoYellow = Color(red: 255/255, green: 229/255, blue: 0)
static let tetrominoGreen = Color(red: 0, green: 214/255, blue: 71/255)
static let tetrominoPurple = Color(red: 168/255, green: 0, blue: 214/255)
static let tetrominoRed = Color(red: 214/255, green: 0, blue: 61/255)
}
extension Tetromino {
var color: Color {
switch self {
case .i:
return .tetrominoAqua
case .o:
return .tetrominoYellow
case .t:
return .tetrominoPurple
case .j:
return .tetrominoOrange
case .l:
return .tetrominoBlue
case .s:
return .tetrominoRed
case .z:
return .tetrominoGreen
}
}
}