uYouEnhanced/Source/LowContrastMode.swift
arichorn a9943de261
Refreshed uYouPlusExtra Branch
Branch has been refreshed to update to the latest commits from qnblackcat/uYouPlus to provide a more up-to-date experience.
2023-08-19 15:21:42 -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