Tải & cài đặt v0.2.0
Copy file vào project. Mỗi file có dòng Generated from VMS tokens v0.2.0 để biết đang dùng bản nào.
iOS · SwiftUI
iOS 14+- Giải nén và kéo
ios/VMSTokens.swiftvào target app trong Xcode (bật “Copy items if needed”). - Thêm file font Inter (Regular, Medium, SemiBold…) vào app và khai báo trong
UIAppFontscủa Info.plist. - Màu tự đổi theo Light/Dark của hệ thống. Cỡ chữ scale theo Dynamic Type.
Text("Xin chào")
.vmsTextStyle(.content)
.foregroundColor(VMSColor.textDefault)
.padding(VMSLayout.screenPadding)
.background(RoundedRectangle(cornerRadius: VMSRadius.r4).stroke()) Android · XML
minSdk 24, Material Components- Giải nén, copy thư mục
values/vàvalues-night/vàoapp/src/main/res/(gộp với thư mục sẵn có). - Thêm font vào
res/font/với têninter_regular.ttf,inter_medium.ttf,inter_semibold.ttf… - Màu Dark nằm ở
values-nightnên tự đổi theo theme hệ thống. Cỡ chữ dùngsp.
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/layout_screen_padding"
android:textAppearance="@style/TextAppearance.VMS.Content"
android:textColor="@color/color_text_default"
android:text="Xin chào" /> Flutter · Dart
Dart 3- Giải nén và copy
flutter/vms_tokens.dartvàolib/. - Khai báo font family
Intertrongpubspec.yaml. - Gắn màu vào theme:
theme: ThemeData(extensions: [VMSColors.light]),darkTheme: ThemeData(extensions: [VMSColors.dark]).
Padding(
padding: const EdgeInsets.all(VMSLayout.screenPadding),
child: Text(
'Xin chào',
style: VMSTextStyles.content.copyWith(color: context.vmsColors.textDefault),
),
) Web · CSS
Mọi trình duyệt hiện đại- Giải nén, copy
web/tokens.cssvào project và import trước CSS của bạn. - Dark theo hệ thống, hoặc ép bằng
<html data-theme="dark">/"light".
.title {
font: var(--typography-content);
color: var(--color-text-default);
padding: var(--layout-screen-padding);
}