Definition text formatting, colorize parts of speech
This commit is contained in:
26
Toki Trainer/Constants.swift
Normal file
26
Toki Trainer/Constants.swift
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Constants.swift
|
||||
// Toki Trainer
|
||||
//
|
||||
// Created by Avery Ada Pace on 11/2/21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
struct K {
|
||||
static let posColors = [
|
||||
"n": UIColor.systemGreen,
|
||||
"mod": UIColor.systemYellow,
|
||||
"sep": UIColor.systemPurple,
|
||||
"vt": UIColor.systemBlue,
|
||||
"vi": UIColor.systemCyan,
|
||||
"interj": UIColor.systemRed,
|
||||
"prep": UIColor.systemBrown,
|
||||
"conj": UIColor.systemBrown,
|
||||
"kama": UIColor.systemBrown,
|
||||
"cont": UIColor.systemBrown,
|
||||
"oth": UIColor.systemBrown,
|
||||
"extra": UIColor.systemBrown
|
||||
]
|
||||
}
|
||||
@@ -20,7 +20,13 @@ struct ContentView: View {
|
||||
ForEach(entry.definitions, id: \.pos) { definition in
|
||||
HStack(alignment: .top) {
|
||||
Text(definition.pos)
|
||||
.frame(width: 60, height: 22, alignment: .center)
|
||||
.background(Color(K.posColors[definition.pos]!))
|
||||
.cornerRadius(5.0)
|
||||
.padding(4)
|
||||
Text(definition.definition)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.padding(4)
|
||||
}
|
||||
}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user