-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add output scripts for swiftui #957
Open
dennispost
wants to merge
5
commits into
main
Choose a base branch
from
feature/swiftui-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f93bdaa
add output scripts for swiftui
dennispost d11d79e
fix linting errors & update typography
dennispost 34e1240
wip new output structure
dennispost e1c42a0
renaming & add accessor visibility
dennispost 523f8ce
update readme
dennispost File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
233 changes: 233 additions & 0 deletions
233
src/utils/outputs/swiftui/AdaptiveColors+Descripitve.swift
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,233 @@ | ||
// | ||
// Copyright 2024 by DB Systel GmbH | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
|
||
import SwiftUI | ||
|
||
public struct BasicColor { | ||
public var text: TextColor | ||
public var icon: IconColor | ||
public var border: BorderColor | ||
public var background: BackgroundColor | ||
} | ||
|
||
public struct InvertedBackgroundColor { | ||
public var contrastMax: StateColor | ||
public var contrastHigh: StateColor | ||
public var contrastLow: StateColor | ||
} | ||
|
||
public struct InvertedColor { | ||
public var background: InvertedBackgroundColor | ||
public var onBackground: StateColor | ||
} | ||
|
||
public struct OriginColor { | ||
public var origin: StateColor | ||
public var onOrigin: StateColor | ||
} | ||
|
||
public struct TextColor { | ||
public var `default`: StateColor | ||
public var emphasis100: StateColor | ||
public var emphasis90: StateColor | ||
public var emphasis80: StateColor | ||
} | ||
|
||
public struct IconColor { | ||
public var `default`: StateColor | ||
public var emphasis100: StateColor | ||
public var emphasis90: StateColor | ||
public var emphasis80: StateColor | ||
public var emphasis70: StateColor | ||
} | ||
|
||
public struct BorderColor { | ||
public var `default`: StateColor | ||
public var emphasis100: StateColor | ||
public var emphasis70: StateColor | ||
public var emphasis60: StateColor | ||
public var emphasis50: StateColor | ||
} | ||
|
||
public struct BackgroundColor { | ||
public var transparent: TransparentColor | ||
public var level1: StateColor | ||
public var level2: StateColor | ||
public var level3: StateColor | ||
} | ||
|
||
public struct TransparentColor { | ||
public var full: Color | ||
public var semi: Color | ||
public var hovered: Color | ||
public var pressed: Color | ||
} | ||
|
||
public struct StateColor { | ||
public var `default`: Color | ||
public var hovered: Color | ||
public var pressed: Color | ||
} | ||
|
||
extension DSColorVariant { | ||
|
||
public var basic: BasicColor { | ||
.init( | ||
text: .init( | ||
default: .init( | ||
default: onBgBasicEmphasis100Default, | ||
hovered: onBgBasicEmphasis100Hovered, | ||
pressed: onBgBasicEmphasis100Pressed | ||
), | ||
emphasis100: .init( | ||
default: onBgBasicEmphasis100Default, | ||
hovered: onBgBasicEmphasis100Hovered, | ||
pressed: onBgBasicEmphasis100Pressed | ||
), | ||
emphasis90: .init( | ||
default: onBgBasicEmphasis80Default, | ||
hovered: onBgBasicEmphasis80Hovered, | ||
pressed: onBgBasicEmphasis80Pressed | ||
), | ||
emphasis80: .init( | ||
default: onBgBasicEmphasis80Default, | ||
hovered: onBgBasicEmphasis80Hovered, | ||
pressed: onBgBasicEmphasis80Pressed | ||
) | ||
), | ||
icon: .init( | ||
default: .init( | ||
default: onBgBasicEmphasis70Default, | ||
hovered: onBgBasicEmphasis70Hovered, | ||
pressed: onBgBasicEmphasis70Pressed | ||
), | ||
emphasis100: .init( | ||
default: onBgBasicEmphasis100Default, | ||
hovered: onBgBasicEmphasis100Hovered, | ||
pressed: onBgBasicEmphasis100Pressed | ||
), | ||
emphasis90: .init( | ||
default: onBgBasicEmphasis90Default, | ||
hovered: onBgBasicEmphasis90Hovered, | ||
pressed: onBgBasicEmphasis90Pressed | ||
), | ||
emphasis80: .init( | ||
default: onBgBasicEmphasis80Default, | ||
hovered: onBgBasicEmphasis80Hovered, | ||
pressed: onBgBasicEmphasis80Pressed | ||
), | ||
emphasis70: .init( | ||
default: onBgBasicEmphasis70Default, | ||
hovered: onBgBasicEmphasis70Hovered, | ||
pressed: onBgBasicEmphasis70Pressed | ||
) | ||
), | ||
border: .init( | ||
default: .init( | ||
default: onBgBasicEmphasis60Default, | ||
hovered: onBgBasicEmphasis60Hovered, | ||
pressed: onBgBasicEmphasis60Pressed | ||
), | ||
emphasis100: .init( | ||
default: onBgBasicEmphasis100Default, | ||
hovered: onBgBasicEmphasis100Hovered, | ||
pressed: onBgBasicEmphasis100Pressed | ||
), | ||
emphasis70: .init( | ||
default: onBgBasicEmphasis70Default, | ||
hovered: onBgBasicEmphasis70Hovered, | ||
pressed: onBgBasicEmphasis70Pressed | ||
), | ||
emphasis60: .init( | ||
default: onBgBasicEmphasis60Default, | ||
hovered: onBgBasicEmphasis60Hovered, | ||
pressed: onBgBasicEmphasis60Pressed | ||
), | ||
emphasis50: .init( | ||
default: onBgBasicEmphasis50Default, | ||
hovered: onBgBasicEmphasis50Hovered, | ||
pressed: onBgBasicEmphasis50Pressed | ||
) | ||
), | ||
background: .init( | ||
transparent: .init( | ||
full: bgBasicTransparentFullDefault, | ||
semi: bgBasicTransparentSemiDefault, | ||
hovered: bgBasicTransparentHovered, | ||
pressed: bgBasicTransparentPressed | ||
), | ||
level1: .init( | ||
default: bgBasicLevel1Default, | ||
hovered: bgBasicLevel1Hovered, | ||
pressed: bgBasicLevel1Pressed | ||
), | ||
level2: .init( | ||
default: bgBasicLevel2Default, | ||
hovered: bgBasicLevel2Hovered, | ||
pressed: bgBasicLevel2Pressed | ||
), | ||
level3: .init( | ||
default: bgBasicLevel3Default, | ||
hovered: bgBasicLevel3Hovered, | ||
pressed: bgBasicLevel3Pressed | ||
) | ||
) | ||
) | ||
} | ||
|
||
public var inverted: InvertedColor { | ||
.init( | ||
background: .init( | ||
contrastMax: .init( | ||
default: bgInvertedContrastMaxDefault, | ||
hovered: bgInvertedContrastMaxHovered, | ||
pressed: bgInvertedContrastMaxPressed | ||
), | ||
contrastHigh: .init( | ||
default: bgInvertedContrastHighDefault, | ||
hovered: bgInvertedContrastHighHovered, | ||
pressed: bgInvertedContrastHighPressed | ||
), | ||
contrastLow: .init( | ||
default: bgInvertedContrastLowDefault, | ||
hovered: bgInvertedContrastLowHovered, | ||
pressed: bgInvertedContrastLowPressed | ||
) | ||
), | ||
onBackground: .init( | ||
default: onBgInvertedDefault, | ||
hovered: onBgInvertedHovered, | ||
pressed: onBgInvertedPressed | ||
) | ||
) | ||
} | ||
|
||
public var origin: OriginColor { | ||
.init( | ||
origin: .init( | ||
default: originDefault, | ||
hovered: originHovered, | ||
pressed: originPressed | ||
), | ||
onOrigin: .init( | ||
default: onOriginDefault, | ||
hovered: onOriginHovered, | ||
pressed: onOriginPressed | ||
) | ||
) | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have any Licence information in other files. Should we remove it here @dennispost?