50 lines
1.4 KiB
Swift
50 lines
1.4 KiB
Swift
//
|
|
// Tetromino+Color.swift
|
|
// Tetris
|
|
//
|
|
// Created by Shadowfacts on 10/15/19.
|
|
// Copyright © 2019 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
import TetrisKit
|
|
|
|
extension Tetromino {
|
|
var color: Color {
|
|
switch self {
|
|
case .i:
|
|
return Color("TetrominoAqua", bundle: .tetrisUI)
|
|
case .o:
|
|
return Color("TetrominoYellow", bundle: .tetrisUI)
|
|
case .t:
|
|
return Color("TetrominoPurple", bundle: .tetrisUI)
|
|
case .j:
|
|
return Color("TetrominoOrange", bundle: .tetrisUI)
|
|
case .l:
|
|
return Color("TetrominoBlue", bundle: .tetrisUI)
|
|
case .s:
|
|
return Color("TetrominoRed", bundle: .tetrisUI)
|
|
case .z:
|
|
return Color("TetrominoGreen", bundle: .tetrisUI)
|
|
}
|
|
}
|
|
var borderColor: Color {
|
|
switch self {
|
|
case .i:
|
|
return Color("TetrominoAquaLight", bundle: .tetrisUI)
|
|
case .o:
|
|
return Color("TetrominoYellowLight", bundle: .tetrisUI)
|
|
case .t:
|
|
return Color("TetrominoPurpleLight", bundle: .tetrisUI)
|
|
case .j:
|
|
return Color("TetrominoOrangeLight", bundle: .tetrisUI)
|
|
case .l:
|
|
return Color("TetrominoBlueLight", bundle: .tetrisUI)
|
|
case .s:
|
|
return Color("TetrominoRedLight", bundle: .tetrisUI)
|
|
case .z:
|
|
return Color("TetrominoGreenLight", bundle: .tetrisUI)
|
|
}
|
|
}
|
|
}
|