Skip to content
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

Mob 35767 fix color generation #59

Merged
merged 13 commits into from
Jan 17, 2024
Merged

Conversation

avShabaeva
Copy link

No description provided.

@hhru hhru deleted a comment from steve-jobs-bot Jan 16, 2024
@@ -131,7 +159,7 @@ final class DefaultColorTokensContextProvider: ColorTokensContextProvider {

let path = token.name.components(separatedBy: ".")

guard path[0] != "gradient" else {
guard path[0] != "gradient" && !dayValue.contains("gradient") else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А зачем тут эта проверка? path[0] != "gradient" проверяет и так, что значение не начинается с gradient

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Там появились новые токены у которых gradient только в value, ранее проверялся только name

    {
      "name": "color.component.scrollable-container.fade.content",
      "value": "linear-gradient(0deg, rgba( {color.base.black} , {semantic.opacity.transparent}) 0%, {color.base.black} {semantic.opacity.visible})",
      "type": "color",
      "$extensions": {
        "id": "928293bc-254c-4bab-801d-7b98132d150b"
      }
    },
    ```

@@ -32,7 +32,7 @@ final class DefaultTokensResolver: TokensResolver {
return hexFloat / 255.0
}

private func makeColor(hex: String, alpha: CGFloat) throws -> Color {
private func makeColor(hex: String, alpha: CGFloat, tokenName: String) throws -> Color {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tokenName не используется?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, спасибо! Я хотела прокинуть в ошибку .invalidHEXComponent tokenName, но оказывается по code style нельзя только в 1 case enum-a прокинуть второй параметр. И я удалила этот код. Но часть забыла.

Comment on lines 16 to 18
// Возвращает набор токенов для определенной темы.
// Для undefined возвращается полный набор токенов. Нужен для Spacer, Font и других независимых от темы параметров.
func getThemeTokenValues(theme: Theme) -> [TokenValue] {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно три слэша, тогда это будет документация метода:

/// Возвращает набор токенов для определенной темы.
/// Для undefined возвращается полный набор токенов. Нужен для Spacer, Font и других независимых от темы параметров.
func getThemeTokenValues(theme: Theme) -> [TokenValue] {

@hhru hhru deleted a comment from steve-jobs-bot Jan 16, 2024
Comment on lines 20 to 24
/// Resolving references and mathematical expressions in `value` from `tokenValues`.
///
/// Reference example: `{core.space.1-x} + {core.space.1-x} / 2`
/// where `core.space.1-x == 1` the resolved value would be `1 + 1 / 2`
/// and after evaluating the mathematical expression, the function will return `1.5`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут описание стоит поправить, эта функция не резолвит самое значение, а только базовую ссылку

@avShabaeva avShabaeva merged commit a9e8943 into develop Jan 17, 2024
3 checks passed
@avShabaeva avShabaeva deleted the MOB-35767_fix_color_generation branch January 17, 2024 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants