uYouEnhanced/Source/LowContrastMode.swift
arichorn bd10c43bfb
Refreshed Branch
the reason for the branch refresh was to completely add new submodules/tweaks that were made by PoomSmart.
2023-07-10 00:10:13 -05:00

43 lines
1.2 KiB
Swift

import UIKit
class ViewController: UIViewController {
@IBOutlet weak var textField: UITextField!
@IBOutlet weak var colorButton: UIButton!
var textColor: UIColor = (red: 0.56, green: 0.56, blue: 0.56, alpha: 1.00)
override func viewDidLoad() {
super.viewDidLoad()
// Configure Text Field
textField.placeholder = "YouTube"
// Configure Color Button
colorButton.setTitleColor(textColor, for: .normal)
}
@IBAction func onColorButtonTap(_ sender: Any) {
let colorPicker = UIColorPickerViewController()
colorPicker.delegate = self
present(colorPicker, animated: true, completion: nil)
}
}
extension ViewController: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
}
extension ViewController: UIColorPickerViewControllerDelegate {
func colorPickerViewControllerDidSelectColor(_ viewController: UIColorPickerViewController) {
textColor = viewController.selectedColor
colorButton.setTitleColor(textColor, for: .normal)
}
func colorPickerViewControllerDidFinish(_ viewController: UIColorPickerViewController) {
dismiss