Skip to content

Commit

Permalink
Merge branch 'feature/css' into feature/gridview
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-schwarz committed Apr 14, 2023
2 parents d3bd4e8 + 92e7d0b commit 955b38a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
11 changes: 11 additions & 0 deletions ownCloudAppShared/User Interface/Theme/CSS/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,17 @@ Example for a `Branding.plist` that fills the logo in the sidebar's navigation b

See *Debugging selectors and matching* > *Usage in practice* above for how to determine the selectors of a view on screen.

#### Icon color CSS selectors
Icon colors are now also configured via CSS selectors:

TVG/Legacy Color | CSS selector string
------------------|------------------------------------
`folderFillColor` | `vectorImage.folderColor.fill`
`fileFillColor` | `vectorImage.fileColor.fill`
`logoFillColor` | `vectorImage.logoColor.fill`
`iconFillColor` | `vectorImage.iconColor.fill`
`symbolFillColor` | `vectorImage.symbolColor.fill`

### Reference
#### Selectors
These selectors are used to differentiate beteween different areas:
Expand Down
30 changes: 15 additions & 15 deletions ownCloudAppShared/User Interface/Theme/ThemeCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -659,11 +659,11 @@ public class ThemeCollection : NSObject {
ThemeCSSRecord(selectors: [.more, .favorite, .disabled], property: .stroke, value: favoriteDisabledColor),

// - TVG icon colors
ThemeCSSRecord(selectors: [.vectorImage, .folderFillColor], property: .fill, value: iconSymbolColor),
ThemeCSSRecord(selectors: [.vectorImage, .fileFillColor], property: .fill, value: iconSymbolColor),
ThemeCSSRecord(selectors: [.vectorImage, .logoFillColor], property: .fill, value: logoFillColor ?? UIColor.white),
ThemeCSSRecord(selectors: [.vectorImage, .iconFillColor], property: .fill, value: iconSymbolColor),
ThemeCSSRecord(selectors: [.vectorImage, .symbolFillColor], property: .fill, value: iconSymbolColor),
ThemeCSSRecord(selectors: [.vectorImage, .folderColor], property: .fill, value: iconSymbolColor),
ThemeCSSRecord(selectors: [.vectorImage, .fileColor], property: .fill, value: iconSymbolColor),
ThemeCSSRecord(selectors: [.vectorImage, .logoColor], property: .fill, value: logoFillColor ?? UIColor.white),
ThemeCSSRecord(selectors: [.vectorImage, .iconColor], property: .fill, value: iconSymbolColor),
ThemeCSSRecord(selectors: [.vectorImage, .symbolColor], property: .fill, value: iconSymbolColor),

// Side Bar
// - Interface Style
Expand Down Expand Up @@ -731,23 +731,23 @@ public class ThemeCollection : NSObject {
if _iconColors == nil {
_iconColors = [:]

_iconColors?["folderFillColor"] = css.getColor(.fill, selectors: [.vectorImage, .folderFillColor], for: nil)?.hexString()
_iconColors?["fileFillColor"] = css.getColor(.fill, selectors: [.vectorImage, .fileFillColor], for: nil)?.hexString()
_iconColors?["logoFillColor"] = css.getColor(.fill, selectors: [.vectorImage, .logoFillColor], for: nil)?.hexString()
_iconColors?["iconFillColor"] = css.getColor(.fill, selectors: [.vectorImage, .iconFillColor], for: nil)?.hexString()
_iconColors?["symbolFillColor"] = css.getColor(.fill, selectors: [.vectorImage, .symbolFillColor], for: nil)?.hexString()
_iconColors?["folderFillColor"] = css.getColor(.fill, selectors: [.vectorImage, .folderColor], for: nil)?.hexString()
_iconColors?["fileFillColor"] = css.getColor(.fill, selectors: [.vectorImage, .fileColor], for: nil)?.hexString()
_iconColors?["logoFillColor"] = css.getColor(.fill, selectors: [.vectorImage, .logoColor], for: nil)?.hexString()
_iconColors?["iconFillColor"] = css.getColor(.fill, selectors: [.vectorImage, .iconColor], for: nil)?.hexString()
_iconColors?["symbolFillColor"] = css.getColor(.fill, selectors: [.vectorImage, .symbolColor], for: nil)?.hexString()
}

return _iconColors ?? [:]
}
}

extension ThemeCSSSelector {
static let folderFillColor = ThemeCSSSelector(rawValue: "folderFillColor")
static let fileFillColor = ThemeCSSSelector(rawValue: "fileFillColor")
static let logoFillColor = ThemeCSSSelector(rawValue: "logoFillColor")
static let iconFillColor = ThemeCSSSelector(rawValue: "iconFillColor")
static let symbolFillColor = ThemeCSSSelector(rawValue: "symbolFillColor")
static let folderColor = ThemeCSSSelector(rawValue: "folderColor")
static let fileColor = ThemeCSSSelector(rawValue: "fileColor")
static let logoColor = ThemeCSSSelector(rawValue: "logoColor")
static let iconColor = ThemeCSSSelector(rawValue: "iconColor")
static let symbolColor = ThemeCSSSelector(rawValue: "symbolColor")
}

extension ThemeCollection {
Expand Down

0 comments on commit 955b38a

Please sign in to comment.