How to use antd-theme-generator - 8 common examples

To help you get started, we’ve selected a few antd-theme-generator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ng-alain / delon / scripts / build / generate-only-color.js View on Github external
// site less file
  mainLessFile: path.join(root, './src/styles.less'),
  themeVariables: [
    '@primary-color',
    '@text-color',
    '@text-color-secondary'
  ],
  // if provided, file will be created with generated less/styles
  outputFilePath
}

if (fs.existsSync(outputFilePath)) {
  fs.unlinkSync(outputFilePath);
}

generateTheme(options).then(less => {
  console.log('Theme generated successfully');
})
.catch(error => {
  console.log('Error', error);
})
github ng-alain / delon / scripts / site / generate-color-less.js View on Github external
@import './theme/styles/app/index';
@import './abc/index';
@import '../src/app/styles/index.less';
`;
fs.writeFileSync(path.resolve(root, '.tmp/all.less'), allLess);

const options = {
  antdStylesDir: path.join(root, 'node_modules/ng-zorro-antd/src/'),
  stylesDir: path.join(root, '.tmp'),
  // varFile: path.join(__dirname, '../components/style/themes/default.less'),
  themeVariables: ['@primary-color'],
  mainLessFile: path.join(root, '.tmp/all.less'),
  outputFilePath: path.join(root, 'src/assets/color.less'),
};

generateTheme(options);
github dotnetcore / OSharp / samples / web / ui-clients / ng-alain8 / scripts / color-less.js View on Github external
fs.writeFileSync(tmpVarFilePath, ALLVAR);
}

function removeVarFile() {
  fs.unlinkSync(tmpVarFilePath);
}

function removeOutputFile() {
  if (fs.existsSync(outputFilePath)) {
    fs.unlinkSync(outputFilePath);
  }
}

genVarFile();
removeOutputFile();
generateTheme(options)
  .then(() => {
    removeVarFile();
    console.log('Theme generated successfully');
  })
  .catch(error => {
    removeVarFile();
    console.log('Error', error);
  });
github mzohaibqc / antd-theme-generator / examples / create-react-app / color.js View on Github external
mainLessFile: path.join(__dirname, './src/styles/main.less'),
  themeVariables: [
    '@primary-color',
    '@secondary-color',
    '@text-color',
    '@text-color-secondary',
    '@heading-color',
    '@layout-body-background',
    '@btn-primary-bg',
    '@layout-header-background'
  ],
  indexFileName: 'index.html',
  outputFilePath: path.join(__dirname, './public/color.less'),
}

generateTheme(options).then(less => {
  console.log('Theme generated successfully');
})
  .catch(error => {
    console.log('Error', error);
  });
github ant-design / ant-design / scripts / generateColorLess.js View on Github external
#!/usr/bin/env node
const path = require('path');
const { generateTheme } = require('antd-theme-generator');

const options = {
  stylesDir: path.join(__dirname, '../site/theme/static'),
  antdStylesDir: path.join(__dirname, '../components'),
  varFile: path.join(__dirname, '../components/style/themes/default.less'),
  mainLessFile: path.join(__dirname, '../site/theme/static/index.less'),
  themeVariables: ['@primary-color'],
  outputFilePath: path.join(__dirname, '../_site/color.less'),
};

generateTheme(options);
github mzohaibqc / antd-theme-webpack-plugin / index.js View on Github external
if (!content.match(/\/color\.less/g)) {
          index.source = () =>
            content.replace(less, "").replace(//gi, `${less}`);
          content = index.source();
          index.size = () => content.length;
        }
      }
      if (options.generateOnce && this.colors) {
        compilation.assets["color.less"] = {
          source: () => this.colors,
          size: () => this.colors.length
        };
        return callback();
      }
      generateTheme(options)
        .then(css => {
          if (options.generateOnce) {
            this.colors = css;
          }
          compilation.assets["color.less"] = {
            source: () => css,
            size: () => css.length
          };
          callback();
        })
        .catch(err => {
          callback(err);
        });
    });
  }
github mzohaibqc / antd-theme-generator / examples / create-react-app / config-overrides.js View on Github external
module.exports = function override(config, env) {
  config = injectBabelPlugin(
    ['import', { libraryName: 'antd', style: true }],
    config
  );
  config = rewireLess.withLoaderOptions({
    modifyVars: getLessVars(path.join(__dirname, './src/styles/vars.less')),
    javascriptEnabled: true
  })(config, env);
  return config;
};

antd-theme-generator

This a script to generate color specific styles less file and which you can use to change theme dynamically in browser

ISC
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis