Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
1
1weather
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
1weather
Commits
98860eea
Commit
98860eea
authored
Apr 08, 2021
by
Demid Merzlyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AirQuality: colored text for pollutants status.
parent
8ced8829
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
272 additions
and
0 deletions
+272
-0
1Weather/Model/ModelObjects/Health/Health.swift
+43
-0
1Weather/Resources/OneWeatherColorsAsset.xcassets/air_quality/good_text.colorset/Contents.json
+38
-0
1Weather/Resources/OneWeatherColorsAsset.xcassets/air_quality/hazardous_text.colorset/Contents.json
+38
-0
1Weather/Resources/OneWeatherColorsAsset.xcassets/air_quality/moderate_text.colorset/Contents.json
+38
-0
1Weather/Resources/OneWeatherColorsAsset.xcassets/air_quality/unhealthy_for_sensitive_groups_text.colorset/Contents.json
+38
-0
1Weather/Resources/OneWeatherColorsAsset.xcassets/air_quality/unhealthy_text.colorset/Contents.json
+38
-0
1Weather/Resources/OneWeatherColorsAsset.xcassets/air_quality/very_unhealthy_text.colorset/Contents.json
+38
-0
1Weather/UI/View controllers/Today/Cells/TodayAirQualityCell/PollutantView.swift
+1
-0
No files found.
1Weather/Model/ModelObjects/Health/Health.swift
View file @
98860eea
...
@@ -58,6 +58,49 @@ public enum HealthStatus: String {
...
@@ -58,6 +58,49 @@ public enum HealthStatus: String {
return
self
.
rawValue
.
localized
()
return
self
.
rawValue
.
localized
()
}
}
public
var
textColor
:
UIColor
{
get
{
switch
self
{
case
.
good
:
guard
let
result
=
UIColor
(
named
:
"good_text"
)
else
{
assertionFailure
(
"Color not available fair quality good_textor !"
)
return
UIColor
(
red
:
8.0
/
255.0
,
green
:
207.0
/
255.0
,
blue
:
0.0
/
97.0
,
alpha
:
1.0
)
}
return
result
case
.
moderate
:
guard
let
result
=
UIColor
(
named
:
"moderate_text"
)
else
{
assertionFailure
(
"Color not available for air quality moderate_text!"
)
return
UIColor
(
red
:
255.0
/
255.0
,
green
:
191.0
/
255.0
,
blue
:
69.0
/
255.0
,
alpha
:
1.0
)
}
return
result
case
.
unhealthyForSensitiveGroups
:
guard
let
result
=
UIColor
(
named
:
"unhealthy_for_sensitive_groups_text"
)
else
{
assertionFailure
(
"Color not available for air quality unhealthy_for_sensitive_groups_text!"
)
return
UIColor
(
red
:
255.0
/
255.0
,
green
:
127.0
/
255.0
,
blue
:
0.0
/
255.0
,
alpha
:
1.0
)
}
return
result
case
.
unhealthy
:
guard
let
result
=
UIColor
(
named
:
"unhealthy_text"
)
else
{
assertionFailure
(
"Color not available for air quality unhealthy_text!"
)
return
UIColor
(
red
:
237.0
/
255.0
,
green
:
81.0
/
255.0
,
blue
:
81.0
/
255.0
,
alpha
:
1.0
)
}
return
result
case
.
veryUnhealthy
:
guard
let
result
=
UIColor
(
named
:
"very_unhealthy_text"
)
else
{
assertionFailure
(
"Color not available for air quality very_unhealthy_text!"
)
return
UIColor
(
red
:
143.0
/
255.0
,
green
:
63.0
/
255.0
,
blue
:
151.0
/
255.0
,
alpha
:
1.0
)
}
return
result
case
.
hazardous
:
guard
let
result
=
UIColor
(
named
:
"hazardous_text"
)
else
{
assertionFailure
(
"Color not available for air quality hazardous_text!"
)
return
UIColor
(
red
:
126.0
/
255.0
,
green
:
0.0
/
255.0
,
blue
:
34.0
/
255.0
,
alpha
:
1.0
)
}
return
result
}
}
}
public
var
gradientColorStart
:
UIColor
{
public
var
gradientColorStart
:
UIColor
{
get
{
get
{
switch
self
{
switch
self
{
...
...
1Weather/Resources/OneWeatherColorsAsset.xcassets/air_quality/good_text.colorset/Contents.json
0 → 100644
View file @
98860eea
{
"colors"
:
[
{
"color"
:
{
"color-space"
:
"srgb"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"97"
,
"green"
:
"207"
,
"red"
:
"8"
}
},
"idiom"
:
"universal"
},
{
"appearances"
:
[
{
"appearance"
:
"luminosity"
,
"value"
:
"dark"
}
],
"color"
:
{
"color-space"
:
"srgb"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"0.380"
,
"green"
:
"0.812"
,
"red"
:
"0.031"
}
},
"idiom"
:
"universal"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
1Weather/Resources/OneWeatherColorsAsset.xcassets/air_quality/hazardous_text.colorset/Contents.json
0 → 100644
View file @
98860eea
{
"colors"
:
[
{
"color"
:
{
"color-space"
:
"display-p3"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"36"
,
"green"
:
"20"
,
"red"
:
"115"
}
},
"idiom"
:
"universal"
},
{
"appearances"
:
[
{
"appearance"
:
"luminosity"
,
"value"
:
"dark"
}
],
"color"
:
{
"color-space"
:
"display-p3"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"0.143"
,
"green"
:
"0.080"
,
"red"
:
"0.452"
}
},
"idiom"
:
"universal"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
1Weather/Resources/OneWeatherColorsAsset.xcassets/air_quality/moderate_text.colorset/Contents.json
0 → 100644
View file @
98860eea
{
"colors"
:
[
{
"color"
:
{
"color-space"
:
"srgb"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"69"
,
"green"
:
"191"
,
"red"
:
"255"
}
},
"idiom"
:
"universal"
},
{
"appearances"
:
[
{
"appearance"
:
"luminosity"
,
"value"
:
"dark"
}
],
"color"
:
{
"color-space"
:
"srgb"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"0.272"
,
"green"
:
"0.748"
,
"red"
:
"1.000"
}
},
"idiom"
:
"universal"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
1Weather/Resources/OneWeatherColorsAsset.xcassets/air_quality/unhealthy_for_sensitive_groups_text.colorset/Contents.json
0 → 100644
View file @
98860eea
{
"colors"
:
[
{
"color"
:
{
"color-space"
:
"display-p3"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"0.341"
,
"green"
:
"0.362"
,
"red"
:
"0.863"
}
},
"idiom"
:
"universal"
},
{
"appearances"
:
[
{
"appearance"
:
"luminosity"
,
"value"
:
"dark"
}
],
"color"
:
{
"color-space"
:
"display-p3"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"0.341"
,
"green"
:
"0.362"
,
"red"
:
"0.863"
}
},
"idiom"
:
"universal"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
1Weather/Resources/OneWeatherColorsAsset.xcassets/air_quality/unhealthy_text.colorset/Contents.json
0 → 100644
View file @
98860eea
{
"colors"
:
[
{
"color"
:
{
"color-space"
:
"srgb"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"81"
,
"green"
:
"81"
,
"red"
:
"238"
}
},
"idiom"
:
"universal"
},
{
"appearances"
:
[
{
"appearance"
:
"luminosity"
,
"value"
:
"dark"
}
],
"color"
:
{
"color-space"
:
"srgb"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"0.317"
,
"green"
:
"0.318"
,
"red"
:
"0.932"
}
},
"idiom"
:
"universal"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
1Weather/Resources/OneWeatherColorsAsset.xcassets/air_quality/very_unhealthy_text.colorset/Contents.json
0 → 100644
View file @
98860eea
{
"colors"
:
[
{
"color"
:
{
"color-space"
:
"display-p3"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"0.578"
,
"green"
:
"0.266"
,
"red"
:
"0.523"
}
},
"idiom"
:
"universal"
},
{
"appearances"
:
[
{
"appearance"
:
"luminosity"
,
"value"
:
"dark"
}
],
"color"
:
{
"color-space"
:
"display-p3"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"0.578"
,
"green"
:
"0.266"
,
"red"
:
"0.523"
}
},
"idiom"
:
"universal"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
1Weather/UI/View controllers/Today/Cells/TodayAirQualityCell/PollutantView.swift
View file @
98860eea
...
@@ -42,6 +42,7 @@ class PollutantView: UIView {
...
@@ -42,6 +42,7 @@ class PollutantView: UIView {
typeLabel
.
text
=
pollutant
.
name
.
localized
typeLabel
.
text
=
pollutant
.
name
.
localized
valueLabel
.
text
=
"
\(
Int
(
pollutant
.
value
)
)
"
valueLabel
.
text
=
"
\(
Int
(
pollutant
.
value
)
)
"
statusLabel
.
text
=
pollutant
.
status
.
localized
statusLabel
.
text
=
pollutant
.
status
.
localized
statusLabel
.
textColor
=
pollutant
.
status
.
textColor
progressValue
=
pollutant
.
progress
progressValue
=
pollutant
.
progress
progressGradient
.
colors
=
[
pollutant
.
status
.
gradientColorStart
.
cgColor
,
progressGradient
.
colors
=
[
pollutant
.
status
.
gradientColorStart
.
cgColor
,
pollutant
.
status
.
gradientColorEnd
.
cgColor
]
pollutant
.
status
.
gradientColorEnd
.
cgColor
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment