Customization

MegaGeneral is build with the idea to make assets globally default, colors and fonts globally accessible and updatable from one file with custom assets.

To customize MegaGeneral template you can change default Colors and Font by editing TemplateColor.swift and TemplateFont.swift files. Than in AppDelegate.swift file use the customized templates:

MGTemplate.configure()
MGTemplate.use(color: TemplateColor.default)
MGTemplate.use(font: TemplateFont.xLarge)

Color

To change the default dark color of MegaGeneral template you have to update the data in the TemplateColor.swift:

return TColor(
    view: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    navigationBar: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    toolBar: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    sideBar: #colorLiteral(red: 0.07309625613, green: 0.06932412941, blue: 0.1093190402, alpha: 1),
    searchBar: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    scrollView: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    tableView: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    tableViewCell: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    tableViewSeparator: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    tableViewHeader: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    tableViewFooter: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    tableViewHeaderSection: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    tableViewFooterSection: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    collectionView: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    collectionViewCell: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    collectionViewHeader: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    collectionViewFooter: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    collectionViewHeaderSection: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    collectionViewFooterSection: #colorLiteral(red: 0.1032132573, green: 0.09788694507, blue: 0.1543604942, alpha: 1),
    activityIndicator: #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1),
    text: TemplateColorText(
        navigationBar: #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1),
        toolBar: #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1),
        primary: #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1),
        secondary: #colorLiteral(red: 0.9529411765, green: 0.968627451, blue: 0.9725490196, alpha: 0.7065681379),
        placeholder: #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1),
        disabled: #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1),
        error: #colorLiteral(red: 0.7450980544, green: 0.1568627506, blue: 0.07450980693, alpha: 1)))

Font

The default font of MegaGeneral is Roboto but you can use your preferred font by changing data into the file TemplateFont.swift:

extension TemplateFontOptions {
    static var xSmall: TFont {
        return TFont(
            largeTitle: MGFont.Roboto.regular.size(31),
            title1: MGFont.Roboto.regular.size(25),
            title2: MGFont.Roboto.regular.size(19),
            title3: MGFont.Roboto.regular.size(17),
            headline: MGFont.Roboto.medium.size(14),
            body: MGFont.Roboto.regular.size(14),
            callout: MGFont.Roboto.regular.size(13),
            subhead: MGFont.Roboto.regular.size(12),
            footnote: MGFont.Roboto.regular.size(12),
            caption1: MGFont.Roboto.regular.size(11),
            caption2: MGFont.Roboto.regular.size(11))
    }
    static var small: TFont {
        return TFont(
            largeTitle: MGFont.Roboto.regular.size(32),
            title1: MGFont.Roboto.regular.size(26),
            title2: MGFont.Roboto.regular.size(20),
            title3: MGFont.Roboto.regular.size(18),
            headline: MGFont.Roboto.medium.size(15),
            body: MGFont.Roboto.regular.size(15),
            callout: MGFont.Roboto.regular.size(14),
            subhead: MGFont.Roboto.regular.size(13),
            footnote: MGFont.Roboto.regular.size(12),
            caption1: MGFont.Roboto.regular.size(11),
            caption2: MGFont.Roboto.regular.size(11))
    }
    static var medium: TFont {
        return TFont(
            largeTitle: MGFont.Roboto.regular.size(33),
            title1: MGFont.Roboto.regular.size(27),
            title2: MGFont.Roboto.regular.size(21),
            title3: MGFont.Roboto.regular.size(19),
            headline: MGFont.Roboto.medium.size(16),
            body: MGFont.Roboto.regular.size(16),
            callout: MGFont.Roboto.regular.size(15),
            subhead: MGFont.Roboto.regular.size(14),
            footnote: MGFont.Roboto.regular.size(12),
            caption1: MGFont.Roboto.regular.size(11),
            caption2: MGFont.Roboto.regular.size(11))
    }
    static var large: TFont {
        return TFont(
            largeTitle: MGFont.Roboto.regular.size(34),
            title1: MGFont.Roboto.regular.size(28),
            title2: MGFont.Roboto.regular.size(22),
            title3: MGFont.Roboto.regular.size(20),
            headline: MGFont.Roboto.medium.size(17),
            body: MGFont.Roboto.regular.size(17),
            callout: MGFont.Roboto.regular.size(16),
            subhead: MGFont.Roboto.regular.size(15),
            footnote: MGFont.Roboto.regular.size(13),
            caption1: MGFont.Roboto.regular.size(12),
            caption2: MGFont.Roboto.regular.size(11))
    }
    static var xLarge: TFont {
        return TFont(
            largeTitle: MGFont.Roboto.regular.size(36),
            title1: MGFont.Roboto.regular.size(30),
            title2: MGFont.Roboto.regular.size(24),
            title3: MGFont.Roboto.regular.size(22),
            headline: MGFont.Roboto.medium.size(19),
            body: MGFont.Roboto.regular.size(19),
            callout: MGFont.Roboto.regular.size(18),
            subhead: MGFont.Roboto.regular.size(17),
            footnote: MGFont.Roboto.regular.size(15),
            caption1: MGFont.Roboto.regular.size(14),
            caption2: MGFont.Roboto.regular.size(13))
    }
    static var xxLarge: TFont {
        return TFont(
            largeTitle: MGFont.Roboto.regular.size(38),
            title1: MGFont.Roboto.regular.size(32),
            title2: MGFont.Roboto.regular.size(26),
            title3: MGFont.Roboto.regular.size(24),
            headline: MGFont.Roboto.medium.size(21),
            body: MGFont.Roboto.regular.size(21),
            callout: MGFont.Roboto.regular.size(20),
            subhead: MGFont.Roboto.regular.size(19),
            footnote: MGFont.Roboto.regular.size(17),
            caption1: MGFont.Roboto.regular.size(16),
            caption2: MGFont.Roboto.regular.size(15))
    }
    static var xxxLarge: TFont {
        return TFont(
            largeTitle: MGFont.Roboto.regular.size(40),
            title1: MGFont.Roboto.regular.size(34),
            title2: MGFont.Roboto.regular.size(28),
            title3: MGFont.Roboto.regular.size(26),
            headline: MGFont.Roboto.medium.size(23),
            body: MGFont.Roboto.regular.size(23),
            callout: MGFont.Roboto.regular.size(22),
            subhead: MGFont.Roboto.regular.size(21),
            footnote: MGFont.Roboto.regular.size(19),
            caption1: MGFont.Roboto.regular.size(18),
            caption2: MGFont.Roboto.regular.size(17))
    }
}