修改整站字体、字重

theme-css-var.html页面

{{#if settings.font_family_all == 'oneblack'}}
{{assign 'family_forn' 'GT-America-Expanded-Black'}}
{{else}}
{{assign 'family_forn' 'GT-America-Standard-Regular'}}
{{/if}}

{{#if settings.font_family_all-body == 'tworegular_body'}}
{{assign 'family_forn_body' 'GT-America-Standard-Regular'}}
{{else}}
{{assign 'family_forn_body' 'GT-America-Expanded-Black'}}
{{/if}}

{{#if settings.font_family_all_two== 'tworegular_two'}}
{{assign 'erji' 'GT-America-Standard-Regular'}}
{{else}}
{{assign 'erji' 'GT-America-Expanded-Black'}}
{{/if}}

{{#if settings.font_family_all_san == 'tworegular_san'}}
{{assign 'sanji' 'GT-America-Standard-Regular'}}
{{else}}
{{assign 'sanji' 'GT-America-Expanded-Black'}}
{{/if}}

<style>
{{ font_face (font_modify settings.title_font_family 'weight' '400') }}
{{ font_face (font_modify settings.title_font_family 'weight' '500') }}
{{ font_face (font_modify settings.title_font_family 'weight' '600') }}
{{ font_face (font_modify settings.title_font_family 'weight' '700') }}
{{ font_face settings.title_font_family }}
{{ font_face (font_modify settings.body_font_family 'weight' '400') }}
{{ font_face (font_modify settings.body_font_family 'weight' '500') }}
{{ font_face (font_modify settings.body_font_family 'weight' '600') }}
{{ font_face (font_modify settings.body_font_family 'weight' '700') }}
{{ font_face settings.body_font_family }}







:root {
    --santitle-font: "{{ sanji}}";
    --ertitle-font: "{{ erji}}";
    --title-font: "{{ family_forn}}";
    --title-font-weight: {{ settings.title_font_family.weight }};
    --title-font-style: {{ settings.title_font_family.style }};
    --title-letter-spacing: {{#if settings.title_letter_spacing == 0}}0.00000001em{{else}}{{ divide settings.title_letter_spacing 1000 }}em{{/if}};
    --title-font-size: {{ settings.title_font_size }}px;
    --title-line-height: {{ settings.title_line_height }};
    --title-text-transform: {{#if settings.title_uppercase}}uppercase{{else}}unset{{/if}};
    --body-font: "{{ family_forn_body}}";
    {{assign 'bodyFontWeight' settings.body_font_family.weight}}
    --body-font-weight: {{ bodyFontWeight }};
    {{assign 'bodyBoldFontWeight' (add bodyFontWeight 300)}}

theme.html页面

<!DOCTYPE html>
<html lang="{{request.locale.iso_code}}">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
    />
    <link rel="canonical" href="{{canonical_url}}" />
    <meta http-equiv="x-dns-prefetch-control" content="on" />
    <link rel="dns-prefetch" href="https://fonts.gstatic.com" />
    <link rel="preconnect" href="https://fonts.gstatic.com" />

    {{#if settings.favicon_image}}
      <link rel="icon" type="image/png" href="{{settings.favicon_image}}" />
    {{/if}}

    {{snippet "title-tag"}}

    {{#if page_description}}
      <meta name="description" content="{{page_description}}" />
    {{/if}}

    {{#if page_keyword}}
      <meta name="keywords" content="{{page_keyword}}" />
    {{/if}}

    {{snippet "meta-tags"}}



    {{snippet "theme-css-var"}}

    {{snippet "stylesheet" href=(asset_url "base.css")}}

    <script src="{{asset_url 'global.js'}}" defer="defer"></script>
{{!-- {{ asset_url 'GT-America-Expanded-Black.otf' }} --}}
    {{content_for_header}}
      <style>
     
        @font-face {
        font-family: 'GT-America-Expanded-Black';
        /* font-style: normal;
        font-weight: 700;
        font-display: swap; */
        src: url('https://cdn-theme.myshopline.com/cdn/shop/prod/2405029587/1722911146473/66bf04de386fac37e1a3fbc7/1724150899758/assets/GT-America-Expanded-Black.otf') format('woff2');
       }
     
        @font-face {
        font-family: 'GT-America-Standard-Regular';
        font-style: normal;
        font-weight: 400;
        font-display: swap;
         src: url('https://cdn-theme.myshopline.com/cdn/shop/prod/2405029587/1722911146473/66bf04de386fac37e1a3fbc7/1723800411734/assets/GT-America-Standard-Regular.otf') format('woff2');
        }
        
        ._menuContent_ou1r8_10 ._info_ou1r8_100 ._menuTitle_ou1r8_105.mega-text{
                font-family: var(--title-font) !important;
        }

        ._menuContainer_1ciib_1 ._info_ou1r8_100 ._menuTitle_ou1r8_105.mega-text{
            font-weight:{{settings.erjimenuandsanji}} !important;
            font-family:var(--ertitle-font) !important;
        }
        ._subMenu_1ciib_21 ._menuTitle_ou1r8_105 ._navTitle_ou1r8_15 {
                font-weight: normal !important;
                 font-family:var( --santitle-font) !important;
               
        }
        </style>
  </head>
      

 settings_schema.json页面

{
        "type": "select",
        "id": "font_family_all",
        "label": "选择标题字体",
        "default": "oneblack",
        "options": [
            {
                "value": "oneblack",
                "label":"GT-America-Expanded-Black"
            },
            {
                "value": "tworegular",
                "label": "GT-America-Standard-Regular"
            }
            
        ]
    },
    {
        "type": "select",
        "id": "font_family_all_two",
        "label": "选择菜单二级字体",
        "default": "tworegular_two",
        "options": [
            {
                "value": "tworegular_one",
                "label": "GT-America-Expanded-Black"
            },
            {
                "value": "tworegular_two",
                "label": "GT-America-Standard-Regular"
            }
        ]
    },
    {
        "type": "select",
        "id": "font_family_all_san",
        "label": "选择菜单三级字体",
        "default": "tworegular_san",
        "options": [
            {
                "value": "tworegulaoner_san",
                "label": "GT-America-Expanded-Black"
            },
            {
                "value": "tworegular_san",
                "label": "GT-America-Standard-Regular"
            }
        ]
    },
    {
        "type": "select",
        "id": "font_family_all-body",
        "label": "选择正文字体",
        "default": "tworegular_body",
        "options": [
            {
                "value": "oneblack_body",
                "label": "GT-America-Expanded-Black"
            },
            {
                "value": "tworegular_body",
                "label": "GT-America-Standard-Regular"
            }
        ]
    },
    {
        "id": "erjimenuandsanji",
        "type": "range",
        "label": "二级菜单和三级菜单粗细",
        "default": 400,
        "min": 300,
        "max": 900,
        "step":100
       
    },
     
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值