在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):material-foundation/material-tokens开源软件地址(OpenSource Url):https://github.com/material-foundation/material-tokens开源编程语言(OpenSource Language):CSS 100.0%开源软件介绍(OpenSource Introduction):Material TokensMaterial Design now supports the Design System Package (DSP) for importing and exporting Material Design Tokens within the Material Theme Builder. DSP can be used in designer and developer workflow tools and Material Component libraries. Let’s dive into how you can use Material Tokens (DSP) within the VSCode extension to generate code. Getting StartedMake sure you have the latest version of VSCode installed on your machine. VSCode is free to download and is open source. After VSCode is installed, navigate to the marketplace on the extensions tab and search for Adobe. Download Adobe XD VSCode extension Click on install and you may have to reopen or reload VSCode. After the extension is successfully installed, you can open Adobe XD by searching for Adobe in the command palette or clicking the “XD” icon in the bottom right. After the plugin opens it should look like the following screenshot. Opening a DSPDownload a customized DSP from the Material Theme Builder or default Material Theme values from this repo and save it to your computer. Open up the folder in VSCode by either dragging it onto the open window or selecting “Open Folder”. Open the Adobe XD plugin and select “Edit Package” on the bottom left, then select “Select Folder”. There should be a notification on the bottom left that should say “Existing package found…” and click on “Open”. Exploring the DSPWith the DSP opened in the plugin you should see the following screenshot. The Material Tokens (DSP) is made up of a few sections (Light, Dark, Default, Palette, Typography). Generating CodeAfter inspecting the DSP you can generate code in the form of tokens to be used in your application. Select “Start Editing” and then “Finish Editing” to trigger code generation. If it is the first time you are doing it there will be a notification to install Style Dictionary. Select “Install” then you will see another notification asking to export tokens. Select “Export tokens” then you will see a notification asking you to open the folder. Opening the folder you will see the following sub directories. This directory is located in the current directory under a newly generated folder “dist”. Opening up the “variables.css” for example you will see the following flat list of tokens used to theme your application. The “android/colors.xml” should look similar. Using the Material Tokens (DSP) will ensure your styles are shared throughout your designer and developer workflow. Learn more about Material Design Tokens. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论