Created
June 7, 2016 17:35
-
-
Save bdalziel/8774cec94b0486b1e7c83a3dfe77b820 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ColorUtil.swift | |
| // FantasyMovieLeague | |
| // | |
| // Created by Ben Dalziel on 2/17/16. | |
| // Copyright © 2016 Kinetoplay. All rights reserved. | |
| // | |
| import SwiftHEXColors | |
| public indirect enum AppUIColors: Int { | |
| case NavBarBackground, | |
| NavBarTint, | |
| NavBarShadow, | |
| NavBarTitle, | |
| PickerNavBarBackground, | |
| PickerNavBarTint, | |
| PickerNavBarTitle, | |
| PickerNavBarTitleAlt, | |
| PickerBudgetText, | |
| PickerBudgetExpensiveText, | |
| LaunchBackground, | |
| ViewControllerBackground, | |
| LeaguesViewControllerBackground, | |
| LeagueViewControllerBackground, | |
| TableBackground, | |
| TableSeparator, | |
| TableSectionText, | |
| TableSectionHeaderText, | |
| TableSectionHeaderAltText, | |
| TableCellSelectedBackground, | |
| TableCellSelectedBackgroundDark, | |
| TableRefreshText, | |
| GroupedTableSeparator, | |
| GroupedTableHeadingText, | |
| UnavailableImageColor0, | |
| UnavailableImageColor1, | |
| AuthFormCellLabelTitle, | |
| AuthFormCellField, | |
| AuthFormCellTint, | |
| FormCellBackground, | |
| FormPlaceholder, | |
| FormSeparator, | |
| FormTextField, | |
| FormErrorMessage, | |
| OnboardingQuestion, | |
| ChatterFormCellLabelTitle, | |
| ChatterFormCellField, | |
| ChatterFormCellTint, | |
| ChatterFormCellBackground, | |
| ChatterFormPlaceholder, | |
| ChatterFormSeparator, | |
| // ChatterFormTextField, | |
| TabBarTint, | |
| TabBarBackground, | |
| TabBarShadow, | |
| TabBarItem, | |
| TabBarItemSelected, | |
| ToolBarBackground, | |
| ComparisonBarYou, | |
| ComparisonBarEntry, | |
| ComparisonBarPerfect, | |
| LaunchGradientTop, | |
| LaunchGradientBottom, | |
| LeagueTableHeader, | |
| LeagueTableHeaderButton, | |
| LeagueTableCellBackground, | |
| LeagueTableCellBackgroundUserEntry, | |
| LeagueMembersText, | |
| LeaguesSegmentedControlTint, | |
| LeaguesSegmentedControlNormalText, | |
| LeaguesSegmentedControlSelectedText, | |
| LeagueName, | |
| LeagueNameOnDark, | |
| LeagueStandingsTableCellBackground, | |
| LeagueStandingsSeparator, | |
| LeagueStandingsTeamName, | |
| LeagueStandingsTeamRank, | |
| LeagueStandingsTeamPoints, | |
| TabbedSegmentedControlTint, | |
| TabbedSegmentedControlNormalText, | |
| TabbedSegmentedControlSelectedText, | |
| TabbedSegmentedControlDisabledText, | |
| TabbedSegmentedControlBackground, | |
| UISwitchTint, | |
| ChatterBoardTableCellBackground, | |
| ChatterBoardsSeparator, | |
| ChatterTopicsSeparator, | |
| TopicTitle, | |
| TopicTitleUnread, | |
| TopicByLine, | |
| TopicByLineAlt, | |
| TopicPostDate, | |
| TopicCommentCount, | |
| TopicBody, | |
| TopicCommentBody, | |
| TopicCommentLink, | |
| TopicCommentLinkActive, | |
| TopicCommentAlt, | |
| TopicCommentBodyBorder, | |
| CommonCellTextOnLeaguesBackground, | |
| CommonCellTextOnViewControllerBackground, | |
| ButtonTint, | |
| ButtonTitleHighlighted, | |
| ButtonTitleSelected, | |
| ButtonBackground, | |
| AltButtonTint, | |
| AltButtonTitleHighlighted, | |
| AltButtonTitleSelected, | |
| AltButtonBorder, | |
| AltButtonBackground, | |
| ToastTitle, | |
| ToastBackground, | |
| TextButtonTint, | |
| TextButtonTitleHighlighted, | |
| TextButtonTitleSelected, | |
| AltTextButtonTint, | |
| AltTextButtonTitleHighlighted, | |
| AltTextButtonTitleSelected, | |
| ToolTipButtonBackground, | |
| SimpleText, | |
| InsiderTitle, | |
| InsiderHeader, | |
| InsiderByline, | |
| InsiderDescription, | |
| InsiderBody, | |
| InsiderImageBorder, | |
| BarButtonTint, | |
| BarButtonTitleHighlighted, | |
| BarButtonTitleSelected, | |
| BarButtonTitleDisabled, | |
| PickerScreensBackground, | |
| PickerAvailableMoviesBackground, | |
| PickerMovieDetailsBackground, | |
| PickerMovieTitle, | |
| PickerMoviePriceLabel, | |
| CineplexMovieBorder, | |
| CineplexMovieBorderLight, | |
| CineplexScreenBackground, | |
| CineplexScreensBackground, | |
| // CineplexScreenBorderNormal, | |
| CineplexScreenMoviePrice, | |
| CineplexScreenMoviePriceTooExpensive, | |
| CineplexScreenBorderSelected, | |
| CineplexScreenBorderDeselected, | |
| CineplexScreenBorderUnavailable, | |
| CineplexScreenScreenTextSelected, | |
| CineplexScreenScreenTextDeselected, | |
| CineplexScreenScreenTextUnavailable, | |
| CineplexScreenScreenNumberTextSelected, | |
| CineplexScreenScreenNumberTextDeselected, | |
| CineplexScreenScreenNumberTextUnavailable, | |
| UserStatHeading, | |
| UserStatValue, | |
| UserStatTappableValue, | |
| UserStatHeadingOnDark, | |
| UserStatValueOnDark, | |
| UserStatTappableValueOnDark, | |
| CineplexComparisonYourText, | |
| CineplexComparisonEntryText, | |
| CineplexComparisonPerfectText, | |
| EntryWeekHeading, | |
| MovieStatValue, | |
| MovieStatValuePrimary, | |
| MovieStatValueAlt, | |
| TipTitle, | |
| TipDescription, | |
| TipIndex, | |
| NotificationLabel | |
| } | |
| public indirect enum AppUIPatterns: Int { | |
| case InsiderPost, | |
| CineplexScreen, | |
| LoginBackground, | |
| LaunchBackground, | |
| LeaguesBackground, | |
| ChatterBackground, | |
| WebViewBackground, | |
| SettingsBackground, | |
| CineplexScreenBackgroundLight | |
| } | |
| class ColorUtil { | |
| enum AppColors: String { | |
| case Beige = "#f5efe0", | |
| Gold = "#cda582", | |
| FMLRed = "#fa463c", | |
| BlackVelvet = "#1e0a14", | |
| DarkVelvet = "#321e28", | |
| Velvet = "#4a283e", //503146", | |
| // Alternate colors - use sparingly | |
| FMLRedAlt = "#e14137", | |
| GoldAlt = "#e1b996" | |
| } | |
| class func color(appColor: AppColors) -> UIColor { | |
| return UIColor(hexString: appColor.rawValue)! | |
| } | |
| class func colorWithAlpha(appColor: AppColors, alpha: Float) -> UIColor { | |
| return UIColor(hexString: appColor.rawValue, alpha: alpha)! | |
| } | |
| class func uiColor(appUIColor: AppUIColors) -> UIColor { | |
| switch appUIColor { | |
| case .NavBarBackground, | |
| .ViewControllerBackground, | |
| .TableBackground, | |
| .PickerNavBarTitleAlt, | |
| .CineplexScreenScreenNumberTextSelected, | |
| .ButtonTint, | |
| .TabBarItem, | |
| .ChatterBoardTableCellBackground, | |
| .PickerMovieDetailsBackground, | |
| .UserStatValueOnDark, | |
| .PickerBudgetText, | |
| .ToolBarBackground, | |
| .TipDescription, | |
| .TipIndex, | |
| .AuthFormCellLabelTitle, | |
| .CineplexComparisonEntryText, | |
| .CineplexComparisonYourText, | |
| .AltTextButtonTint, | |
| .AltButtonBackground, | |
| .ChatterFormCellBackground, | |
| .LeagueStandingsTeamName, | |
| .LeagueNameOnDark, | |
| .ToastTitle, | |
| .OnboardingQuestion: | |
| return color(AppColors.Beige) | |
| // case .TableCellSelectedBackground: | |
| // return color(AppColors.BeigeAlt) | |
| case .ButtonTitleSelected, | |
| .ButtonTitleHighlighted, | |
| .AltTextButtonTitleSelected, | |
| .AltTextButtonTitleHighlighted: | |
| return colorWithAlpha(AppColors.Beige, alpha: 0.7) | |
| case .NavBarShadow, | |
| .TableSeparator, | |
| .PickerNavBarTitle, | |
| .LeaguesSegmentedControlTint, | |
| .LeagueMembersText, | |
| .CommonCellTextOnViewControllerBackground, | |
| .CineplexScreenBorderSelected, | |
| .CineplexScreenScreenTextSelected, | |
| .CommonCellTextOnLeaguesBackground, | |
| .ChatterBoardsSeparator, | |
| .ChatterTopicsSeparator, | |
| .InsiderImageBorder, | |
| .UserStatHeading, | |
| .UserStatHeadingOnDark, | |
| .TipTitle, | |
| .TabBarBackground, | |
| .MovieStatValueAlt, | |
| .TopicCommentBodyBorder, | |
| .GroupedTableSeparator, | |
| .GroupedTableHeadingText, | |
| .CineplexScreenMoviePrice, | |
| .TableRefreshText, | |
| .AltButtonBorder, | |
| .CineplexMovieBorderLight, | |
| .AuthFormCellField, | |
| .ComparisonBarPerfect, | |
| .TabbedSegmentedControlSelectedText, | |
| .UISwitchTint, | |
| .ChatterFormCellLabelTitle, | |
| .ChatterFormPlaceholder, | |
| .ChatterFormSeparator, | |
| .PickerMoviePriceLabel, | |
| .LeagueStandingsTeamPoints, | |
| .BarButtonTitleDisabled: | |
| return color(AppColors.Gold) | |
| case .TabBarShadow, | |
| .TableCellSelectedBackground, | |
| .LeagueTableHeader: | |
| return color(AppColors.GoldAlt) | |
| case .NavBarTint, | |
| .PickerNavBarTint, | |
| .BarButtonTint, | |
| .ButtonBackground, | |
| .CineplexScreenBorderDeselected, | |
| .LeaguesSegmentedControlNormalText, | |
| .AuthFormCellTint, | |
| .PickerBudgetExpensiveText, | |
| .TableSectionHeaderAltText, | |
| .UserStatTappableValue, | |
| .UserStatTappableValueOnDark, | |
| .TopicCommentAlt, | |
| .TopicByLineAlt, | |
| .AltButtonTint, | |
| .TextButtonTint, | |
| .InsiderTitle, | |
| .TopicCommentLink, | |
| .TopicCommentCount, | |
| .CineplexScreenMoviePriceTooExpensive, | |
| .ComparisonBarYou, | |
| .MovieStatValuePrimary, | |
| .EntryWeekHeading, | |
| .TopicTitleUnread, | |
| .TabbedSegmentedControlNormalText, | |
| .ChatterFormCellTint, | |
| .FormErrorMessage, | |
| .LeagueStandingsTeamRank, | |
| .ToastBackground, | |
| .LeagueTableHeaderButton: | |
| return color(AppColors.FMLRed) | |
| case .BarButtonTitleHighlighted, | |
| .BarButtonTitleSelected, | |
| .AltButtonTitleHighlighted, | |
| .AltButtonTitleSelected, | |
| .TextButtonTitleHighlighted, | |
| .TextButtonTitleSelected, | |
| .TopicCommentLinkActive: | |
| return colorWithAlpha(AppColors.FMLRed, alpha: 0.7) | |
| case .PickerScreensBackground, | |
| .PickerNavBarBackground, | |
| .CineplexScreensBackground, | |
| .LaunchGradientBottom, | |
| .UnavailableImageColor0, | |
| .LeaguesSegmentedControlSelectedText, | |
| .LeaguesViewControllerBackground, | |
| .CineplexComparisonPerfectText, | |
| .FormSeparator, | |
| .FormPlaceholder, | |
| .LeagueStandingsSeparator, | |
| .TabbedSegmentedControlDisabledText, | |
| .TableCellSelectedBackgroundDark: | |
| return color(AppColors.BlackVelvet) | |
| case .LaunchBackground, | |
| .PickerAvailableMoviesBackground, | |
| .LeagueTableCellBackground, | |
| .UnavailableImageColor1, | |
| .TableSectionText, | |
| .NavBarTitle, | |
| .CineplexScreenBackground, | |
| .InsiderHeader, | |
| .InsiderByline, | |
| .InsiderDescription, | |
| .InsiderBody, | |
| .UserStatValue, | |
| .TableSectionHeaderText, | |
| .SimpleText, | |
| .MovieStatValue, | |
| .TopicTitle, | |
| .TopicByLine, | |
| .TopicPostDate, | |
| .TopicBody, | |
| .TopicCommentBody, | |
| .FormCellBackground, | |
| .FormTextField, | |
| .TabbedSegmentedControlBackground, | |
| .NotificationLabel, | |
| .LeagueViewControllerBackground, | |
| .LeagueStandingsTableCellBackground, | |
| .ChatterFormCellField, | |
| .PickerMovieTitle, | |
| .LeagueName: | |
| return color(AppColors.DarkVelvet) | |
| case .TabBarTint, | |
| .CineplexScreenBorderUnavailable, | |
| .CineplexScreenScreenTextDeselected, | |
| .CineplexScreenScreenTextUnavailable, | |
| .CineplexScreenScreenNumberTextDeselected, | |
| .CineplexScreenScreenNumberTextUnavailable, | |
| .CineplexMovieBorder, | |
| .TabBarItemSelected, | |
| .ComparisonBarEntry, | |
| .TabbedSegmentedControlTint, | |
| .LeagueTableCellBackgroundUserEntry: | |
| return color(AppColors.Velvet) | |
| case .ToolTipButtonBackground : | |
| return color(AppColors.FMLRedAlt) | |
| case .LaunchGradientTop : | |
| return colorWithAlpha(AppColors.BlackVelvet, alpha: 0.0) | |
| } | |
| } | |
| class func uiPattern(appUIPattern: AppUIPatterns) -> UIColor { | |
| switch appUIPattern { | |
| case .InsiderPost: | |
| return UIColor(patternImage: UIImage.init(named: "FML Pattern Light")!) | |
| case .ChatterBackground, | |
| .CineplexScreenBackgroundLight, | |
| .SettingsBackground, | |
| .WebViewBackground: | |
| // Subtle | |
| return UIColor(patternImage: UIImage.init(named: "FML Pattern Light")!) | |
| case .CineplexScreen: | |
| return UIColor(patternImage: UIImage.init(named: "FML Pattern Dark")!) | |
| case .LeaguesBackground, | |
| .LoginBackground: | |
| // Subtle | |
| return UIColor(patternImage: UIImage.init(named: "FML Pattern Dark Subtle")!) | |
| case .LaunchBackground : | |
| return UIColor(patternImage: UIImage.init(named: "FML Pattern Dark Subtle - Launch")!) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment