def set_module_css_file(self, module): super(CodeGeneratorWriter, self).set_module_css_file(module) if not module.theme_website: return # _variables.scss files cw = CodeWriter(default_width=80) # cw.emit(f"$primary: {module.theme_website_primary_color} !default;") # cw.emit(f"$secondary: {module.theme_website_secondary_color} !default;") # cw.emit(f"$body-color: {module.theme_website_body_color} !default;") file_path = os.path.join(self.code_generator_data.css_path, "_variables.scss") self.code_generator_data.write_file_str(file_path, cw.render()) # custom.scss files cw = CodeWriter() file_path = os.path.join(self.code_generator_data.css_path, "custom.scss") self.code_generator_data.write_file_str(file_path, cw.render()) # primary_variables.scss files cw = CodeWriter() file_path = os.path.join(self.code_generator_data.css_path, "primary_variables.scss") cw.emit("$o-theme-layout: 'full';") cw.emit("//$o-theme-navbar-height: 300px;") cw.emit() cw.emit("//" + "-" * 78) cw.emit_wrapped_text( "Colors", prefix="// ", indent_after_first=True, ) cw.emit("//" + "-" * 78) cw.emit() cw.emit("// Extend default color palettes with website-related colors") cw.emit("$-palettes: ();") cw.emit("@each $palette in $o-color-palettes {") with cw.indent(): cw.emit("$-palettes: append($-palettes, map-merge((") with cw.indent(): cw.emit(f"'body': {module.theme_website_body_color},") cw.emit(f"'menu': {module.theme_website_menu_color},") cw.emit(f"'footer': {module.theme_website_footer_color},") cw.emit(f"'text': {module.theme_website_text_color},") cw.emit(f"'alpha': {module.theme_website_primary_color},") cw.emit(f"'beta': {module.theme_website_secondary_color},") cw.emit(f"'gamma': {module.theme_website_extra_1_color},") cw.emit(f"'delta': {module.theme_website_extra_2_color},") cw.emit(f"'epsilon': {module.theme_website_extra_3_color},") cw.emit(f"'h1': null, // Default to text") cw.emit(f"'h2': null, // Default to h1") cw.emit(f"'h3': null, // Default to h2") cw.emit(f"'h4': null, // Default to h3") cw.emit(f"'h5': null, // Default to h4") cw.emit(f"'h6': null, // Default to h5") cw.emit("), $palette));") cw.emit("}") cw.emit() cw.emit("$o-color-palettes: $-palettes;") cw.emit() cw.emit("$o-theme-color-palettes: ();") cw.emit("@each $-palette in $-palettes {") with cw.indent(): cw.emit( "$o-theme-color-palettes: append($o-theme-color-palettes, map-merge($-palette, (" ) with cw.indent(): cw.emit("'primary': map-get($-palette, 'alpha'),") cw.emit("'secondary': map-get($-palette, 'beta'),") cw.emit(")));") cw.emit("}") cw.emit() cw.emit("// By default, all user color palette values are null. Each null value is") cw.emit("// automatically replaced with corresponding color of chosen color palette.") cw.emit("$o-user-color-palette: () !default;") cw.emit() cw.emit("// By default, all user theme color palette values are null. Each null value") cw.emit("// is automatically replaced with corresponding color of chosen theme color") cw.emit("// palette.") cw.emit("$o-user-theme-color-palette: () !default;") cw.emit() cw.emit("//" + "-" * 78) cw.emit_wrapped_text( "Fonts", prefix="// ", indent_after_first=True, ) cw.emit("//" + "-" * 78) cw.emit() cw.emit("$o-theme-fonts: (") with cw.indent(): cw.emit( '(-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Noto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"), // This is BS default' ) cw.emit("('Open Sans', sans-serif),") cw.emit("('Source Sans Pro', sans-serif),") cw.emit("('Raleway', sans-serif),") cw.emit("('Noto Serif', serif),") cw.emit("('Arvo', Times, serif),") cw.emit(") !default;") cw.emit("$o-theme-font-urls: (") with cw.indent(): cw.emit("null,") cw.emit("'Open+Sans:400,400i,700,700i',") cw.emit("'Source+Sans+Pro:400,400i,700,700i',") cw.emit("'Raleway:400,400i,700,700i',") cw.emit("'Noto+Serif:400,400i,700,700i',") cw.emit("'Arvo:400,400i,700,700i',") cw.emit(") !default;") cw.emit("$o-theme-font-names: (") with cw.indent(): cw.emit("'Bootstrap',") cw.emit("'Open Sans',") cw.emit("'Source Sans Pro',") cw.emit("'Raleway',") cw.emit("'Noto Serif',") cw.emit("'Arvo',") cw.emit(") !default;") cw.emit("$o-theme-font-number: 1 !default;") cw.emit("$o-theme-headings-font-number: 1 !default;") cw.emit("$o-theme-buttons-font-number: 1 !default;") cw.emit("$o-theme-navbar-font-number: 1 !default;") self.code_generator_data.write_file_str(file_path, cw.render())