//
//  Color+.swift
//  Toolboxes
//
//  Created by 研发2组 on 2024/9/27.
//

import SwiftUI

extension Color {
    static let customgradient_top = Color(hex: "#E5E8ED")
    static let customgradient_bottom = Color(hex: "#FEFEFE")
    
    static let tab_nor = Color(hex: "#BBBCBE")
    static let tab_sel = Color(hex: "#141519")
    
    static let customshadow = Color(hex: "#d8dce4")
    
    static let customtextcolor = Color(hex: "#6A6B6D")
    static let customblue = Color(hex: "#82B3E4")
    static let customWhite = Color(hex: "#F3F4F6")
    static let customdeepblue = Color(hex: "#0957F5")
    
    
    static let customRed = Color(hex: "#AE3B2C")
    static let customGreen = Color(hex: "#00705F")
    static let customBrown = Color(hex: "#A4815E")
    static let customBlack = Color(hex: "#3A2E1B")
    static let customLine = Color(hex: "#E4E6E8")
    
}

extension Color {
    init(hex: String) {
        let scanner = Scanner(string: hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted))
        var hexNumber: UInt64 = 0
        scanner.scanHexInt64(&hexNumber)
        
        let r, g, b: Double
        let a: Double = 1.0
        
        r = Double((hexNumber & 0xff0000) >> 16) / 255
        g = Double((hexNumber & 0x00ff00) >> 8) / 255
        b = Double(hexNumber & 0x0000ff) / 255
        
        self.init(.sRGB, red: r, green: g, blue: b, opacity: a)
    }
}
