You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Zinkue (via GitHub)" <gi...@apache.org> on 2025/11/17 22:33:14 UTC

[PR] Add theme config [airflow]

Zinkue opened a new pull request, #58411:
URL: https://github.com/apache/airflow/pull/58411

   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you 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.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   closes: #53443
   related:  #56854
   
   Enables the personalization of Chakra's UI theme via `theme` configuration property
   Currently only the ``brand`` color palette can be customized.
   Modifying the `brand` color palette you also modify the navbar/sidebar.
   
   Provided a how-to-guide for customizing UI theme.
   
   ### Screenshots
   **Input**
   `green` from `theme.ts`
   ``` env
   AIRFLOW__API__THEME='{
     "tokens": {
       "colors": {
         "brand": {
           "50": { "value": "oklch(0.982 0.018 155.826)" },
           "100": { "value": "oklch(0.962 0.044 156.743)" },
           "200": { "value": "oklch(0.925 0.084 155.995)" },
           "300": { "value": "oklch(0.75 0.18 153.0)" },
           "400": { "value": "oklch(0.625 0.209 150.0)" },
           "500": { "value": "oklch(0.528 0.219 149.579)" },
           "600": { "value": "oklch(0.47 0.20 149.0)" },
           "700": { "value": "oklch(0.40 0.16 149.5)" },
           "800": { "value": "oklch(0.448 0.119 151.328)" },
           "900": { "value": "oklch(0.393 0.095 152.535)" },
           "950": { "value": "oklch(0.266 0.065 152.934)" }
         }
       }
     }
   }'
   ```
   **Output**
   <img width="1688" height="1242" alt="green" src="https://github.com/user-attachments/assets/e789ea07-c279-45d0-8164-b11356a46e84" />
   
   **Input**
   `yellow` from `theme.ts`
   ``` env
   AIRFLOW__API__THEME='{
     "tokens": {
       "colors": {
         "brand": {
           "50": { "value": "oklch(0.987 0.026 102.212)" },
           "100": { "value": "oklch(0.973 0.071 103.193)" },
           "200": { "value": "oklch(0.945 0.129 101.54)" },
           "300": { "value": "oklch(0.905 0.182 98.111)" },
           "400": { "value": "oklch(0.852 0.199 91.936)" },
           "500": { "value": "oklch(0.795 0.184 86.047)" },
           "600": { "value": "oklch(0.681 0.162 75.834)" },
           "700": { "value": "oklch(0.554 0.135 66.442)" },
           "800": { "value": "oklch(0.476 0.114 61.907)" },
           "900": { "value": "oklch(0.421 0.095 57.708)" },
           "950": { "value": "oklch(0.286 0.066 53.813)" },
         },
       }
     }
   }'
   ```
   **Output**
   <img width="1688" height="1194" alt="yellow" src="https://github.com/user-attachments/assets/a6b2c6f0-26c6-406f-ac9b-8744756bda95" />
   
   **Input**
   `red` from `theme.ts`
   ``` env
   AIRFLOW__API__THEME='{
     "tokens": {
       "colors": {
         "brand": {
           "50": { "value": "oklch(0.971 0.013 17.38)" },
           "100": { "value": "oklch(0.936 0.032 17.717)" },
           "200": { "value": "oklch(0.885 0.062 18.334)" },
           "300": { "value": "oklch(0.808 0.114 19.571)" },
           "400": { "value": "oklch(0.704 0.191 22.216)" },
           "500": { "value": "oklch(0.637 0.237 25.331)" },
           "600": { "value": "oklch(0.577 0.245 27.325)" },
           "700": { "value": "oklch(0.505 0.213 27.518)" },
           "800": { "value": "oklch(0.444 0.177 26.899)" },
           "900": { "value": "oklch(0.396 0.141 25.723)" },
           "950": { "value": "oklch(0.258 0.092 26.042)" }
         }
       }
     }
   }'
   ```
   **Output**
   <img width="1694" height="1199" alt="red" src="https://github.com/user-attachments/assets/eb8d8003-67bc-4469-97d2-c97fa8cce150" />
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add theme config [airflow]

Posted by "Zinkue (via GitHub)" <gi...@apache.org>.
Zinkue commented on code in PR #58411:
URL: https://github.com/apache/airflow/pull/58411#discussion_r2597746426


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/TaskLogHeader.tsx:
##########
@@ -85,6 +85,7 @@ export const TaskLogHeader = ({
   const sources = searchParams.getAll(SearchParamsKeys.SOURCE);
   const logLevels = searchParams.getAll(SearchParamsKeys.LOG_LEVEL);
   const hasLogLevels = logLevels.length > 0;
+  const system = createTheme();

Review Comment:
   Because in this same file, line 92, we have this constant using `system`
   ``` javascript
   const zIndex = isFullscreen
       ? Number(system.tokens.categoryMap.get("zIndex")?.get("modal")?.value ?? 1400) + 1
       : undefined;
   ```
   Since my proposal uses a function to generate the custom theme I need to call it somewhere. I decided to call it in this file.
   Another possibility could by to create a `defaultSystem` in `src/theme` and import it in this file
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add theme config [airflow]

Posted by "marcosmartinezfco (via GitHub)" <gi...@apache.org>.
marcosmartinezfco commented on PR #58411:
URL: https://github.com/apache/airflow/pull/58411#issuecomment-3657719245

   > > Amazing feature, is this expected to be released in version 3.2 or earlier?
   > 
   > This is a feature and will be in next minor release (3.2.0), we follow semver.
   
   Sweet, thanks so much. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add theme config [airflow]

Posted by "marcosmartinezfco (via GitHub)" <gi...@apache.org>.
marcosmartinezfco commented on PR #58411:
URL: https://github.com/apache/airflow/pull/58411#issuecomment-3655414187

   Amazing feature, is this expected to be released in version `3.2` or earlier?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add theme config [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #58411:
URL: https://github.com/apache/airflow/pull/58411#discussion_r2590023937


##########
airflow-core/src/airflow/ui/src/context/chakraCustom/ChakraCustomProvider.tsx:
##########


Review Comment:
   This doesn't need to be its own sub-directory. Just `.../context/CustomChakraProvider.tsx` is ok



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add theme config [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi merged PR #58411:
URL: https://github.com/apache/airflow/pull/58411


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add theme config [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #58411:
URL: https://github.com/apache/airflow/pull/58411#discussion_r2598882337


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/TaskLogHeader.tsx:
##########
@@ -85,6 +85,7 @@ export const TaskLogHeader = ({
   const sources = searchParams.getAll(SearchParamsKeys.SOURCE);
   const logLevels = searchParams.getAll(SearchParamsKeys.LOG_LEVEL);
   const hasLogLevels = logLevels.length > 0;
+  const system = createTheme();

Review Comment:
   Yeah, perhaps its best to pull something like that out into a json object



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add theme config [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #58411:
URL: https://github.com/apache/airflow/pull/58411#discussion_r2590021324


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/TaskLogHeader.tsx:
##########
@@ -85,6 +85,7 @@ export const TaskLogHeader = ({
   const sources = searchParams.getAll(SearchParamsKeys.SOURCE);
   const logLevels = searchParams.getAll(SearchParamsKeys.LOG_LEVEL);
   const hasLogLevels = logLevels.length > 0;
+  const system = createTheme();

Review Comment:
   Why are we calling this inside the tasklogheader?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add theme config [airflow]

Posted by "Zinkue (via GitHub)" <gi...@apache.org>.
Zinkue commented on PR #58411:
URL: https://github.com/apache/airflow/pull/58411#issuecomment-3567921467

   Link to previous discussion/PR: #56854


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add theme config [airflow]

Posted by "Zinkue (via GitHub)" <gi...@apache.org>.
Zinkue commented on code in PR #58411:
URL: https://github.com/apache/airflow/pull/58411#discussion_r2597837554


##########
airflow-core/src/airflow/ui/src/context/ChakraCustomProvider.tsx:
##########


Review Comment:
   Done!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add theme config [airflow]

Posted by "Zinkue (via GitHub)" <gi...@apache.org>.
Zinkue commented on PR #58411:
URL: https://github.com/apache/airflow/pull/58411#issuecomment-3544158673

   About the palette generator for us to make a suggestion.
   
   I found this ones:
   - https://www.tints.dev/
   - https://www.tailwindshades.com/
   
   Played a little bit with them and both looks fine to me


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add theme config [airflow]

Posted by "Zinkue (via GitHub)" <gi...@apache.org>.
Zinkue commented on code in PR #58411:
URL: https://github.com/apache/airflow/pull/58411#discussion_r2608167118


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/TaskLogHeader.tsx:
##########
@@ -85,6 +85,7 @@ export const TaskLogHeader = ({
   const sources = searchParams.getAll(SearchParamsKeys.SOURCE);
   const logLevels = searchParams.getAll(SearchParamsKeys.LOG_LEVEL);
   const hasLogLevels = logLevels.length > 0;
+  const system = createTheme();

Review Comment:
   Created a `defaultSystem` in `src/theme` and imported into `TaskLogHeader.tsx`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add theme config [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on PR #58411:
URL: https://github.com/apache/airflow/pull/58411#issuecomment-3656288530

   > Amazing feature, is this expected to be released in version 3.2 or earlier?
   
   
   This is a feature and will be in next minor release (3.2.0), we follow semver. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org