mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Add swiftgen build script for generating image and color assets.
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
//
|
||||
// Colors.swift
|
||||
// ElementX
|
||||
//
|
||||
// Created by Stefan Ceriu on 29/03/2022.
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
|
||||
// TODO: Switch this to SwiftGen
|
||||
|
||||
extension Color {
|
||||
static let elementGreen = Color(ColorNames.elementGreen.rawValue)
|
||||
static let codeBlockBackgroundColor = Color(ColorNames.codeBlockBackgroundColor.rawValue)
|
||||
}
|
||||
|
||||
extension UIColor {
|
||||
static let elementGreen = UIColor(named: ColorNames.elementGreen.rawValue)
|
||||
static let codeBlockBackgroundColor = UIColor(named: ColorNames.codeBlockBackgroundColor.rawValue)
|
||||
}
|
||||
|
||||
private enum ColorNames: String {
|
||||
case elementGreen
|
||||
case codeBlockBackgroundColor
|
||||
|
||||
var rawValue: String {
|
||||
switch self {
|
||||
case .elementGreen:
|
||||
return "ElementGreen"
|
||||
case .codeBlockBackgroundColor:
|
||||
return "CodeBlockBackgroundColor"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,7 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
|
||||
attributedString.enumerateAttribute(.backgroundColor, in: .init(location: 0, length: attributedString.length), options: []) { value, range, _ in
|
||||
if let value = value as? UIColor,
|
||||
value == temporaryCodeBlockMarkingColor {
|
||||
attributedString.addAttribute(.backgroundColor, value: UIColor.codeBlockBackgroundColor as Any, range: range)
|
||||
attributedString.addAttribute(.backgroundColor, value: Asset.Colors.codeBlockBackground.color as Any, range: range)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user