Skip to content

Commit

Permalink
use Loopgreen, loopred, loopyellow on BG Text & SNoozer BG
Browse files Browse the repository at this point in the history
for a less agressive look
  • Loading branch information
dsnallfot committed Mar 31, 2024
1 parent ab8f14e commit 0057816
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
8 changes: 4 additions & 4 deletions LoopFollow/Application/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="gif-qe-9mv">
<rect key="frame" x="16" y="12.999999999999998" width="31.666666666666668" height="19.333333333333332"/>
<rect key="frame" x="16" y="13" width="30" height="18"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Detail" textAlignment="right" lineBreakMode="characterWrap" baselineAdjustment="none" minimumFontSize="8" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" id="hfT-xF-eNt">
<rect key="frame" x="141.33333333333334" y="12.999999999999998" width="41.666666666666664" height="19.333333333333332"/>
<rect key="frame" x="143.66666666666666" y="13" width="39.333333333333336" height="18"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
Expand Down
6 changes: 3 additions & 3 deletions LoopFollow/Controllers/StatsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ extension MainViewController {
chartEntry.append(value)

if pieData[i].name == "high" {
if let color = UIColor(named: "LoopYellow")?.withAlphaComponent(0.8) {
if let color = UIColor(named: "LoopYellow") { //? }.withAlphaComponent(0.8) {
colors.append(color)
}
} else if pieData[i].name == "low" {
if let color = UIColor(named: "LoopRed")?.withAlphaComponent(0.8) {
if let color = UIColor(named: "LoopRed") { //? }.withAlphaComponent(0.8) {
colors.append(color)
}
} else {
if let color = UIColor(named: "LoopGreen")?.withAlphaComponent(0.8) {
if let color = UIColor(named: "LoopGreen") { //? }.withAlphaComponent(0.8) {
colors.append(color)
}
}
Expand Down
27 changes: 19 additions & 8 deletions LoopFollow/ViewControllers/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -510,16 +510,27 @@ class MainViewController: UIViewController, UITableViewDataSource, ChartViewDele

func setBGTextColor() {
if bgData.count > 0 {
guard let snoozer = self.tabBarController!.viewControllers?[2] as? SnoozeViewController else { return }
guard let snoozer = self.tabBarController?.viewControllers?[2] as? SnoozeViewController else { return }
let latestBG = bgData[bgData.count - 1].sgv
var color: NSUIColor = NSUIColor.label
var color: UIColor = .label // Default color

if UserDefaultsRepository.colorBGText.value {
if Float(latestBG) >= UserDefaultsRepository.highLine.value {
color = NSUIColor.systemYellow
} else if Float(latestBG) <= UserDefaultsRepository.lowLine.value {
color = NSUIColor.systemRed
} else {
color = NSUIColor.systemGreen
if let loopYellow = UIColor(named: "LoopYellow") {
if Float(latestBG) >= UserDefaultsRepository.highLine.value {
color = loopYellow
}
}

if let loopRed = UIColor(named: "LoopRed") {
if Float(latestBG) <= UserDefaultsRepository.lowLine.value {
color = loopRed
}
}

if let loopGreen = UIColor(named: "LoopGreen") {
if Float(latestBG) > UserDefaultsRepository.lowLine.value && Float(latestBG) < UserDefaultsRepository.highLine.value {
color = loopGreen
}
}
}

Expand Down

0 comments on commit 0057816

Please sign in to comment.