-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into nico-16122023
- Loading branch information
Showing
8 changed files
with
175 additions
and
48 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
--- | ||
title: "Customizing CSS" | ||
date: 2024-01-13T22:00:50+06:00 | ||
author: | ||
name: Emruz Hossain | ||
image: images/author/emruz.jpg | ||
menu: | ||
sidebar: | ||
name: CSS Customization | ||
identifier: customize-css | ||
parent: customizing | ||
weight: 407 | ||
--- | ||
|
||
|
||
This theme allows you to customize the appearance of your site and its components by overriding the default CSS. This guide will demonstrate how to override the theme's color scheme and customize the CSS of individual components. | ||
|
||
This theme uses [Sass](https://sass-lang.com/) to generate CSS. If you are not familiar with Sass, you can learn more about it from [here](https://sass-lang.com/guide). | ||
|
||
## Override Theme Colors Variables | ||
|
||
If you want to change the default color scheme of the theme, you can override the theme color variables. To override the theme color variables, you need to create a file named `variables.scss` in the `assets/styles` directory of your site. Then copy the content of the default [variables.scss](https://github.com/hugo-toha/toha/blob/main/assets/styles/variables.scss) file and put into your custom `variables.scss` file. Here, only the `$theme` section from default `variables.scss` file is shown below: | ||
|
||
```scss | ||
// themes | ||
$themes: ( | ||
'light': ( | ||
// cyan 600 | ||
'accent-color': #0891b2, | ||
// cyan 500 | ||
'hover-over-accent-color': #06b6d4, | ||
// zinc 200 | ||
'text-over-accent-color': #e4e4e7, | ||
// slate 50 | ||
'bg-primary': #f8fafc, | ||
// slate 900 | ||
'bg-primary-inverse': #0f172a, | ||
// slate 200 | ||
'bg-secondary': #e2e8f0, | ||
'bg-card': #fff, | ||
// slate 800 | ||
'heading-color': #1e293b, | ||
// slate 700 | ||
'text-color': #334155, | ||
// slate 300 | ||
'inverse-text-color': #cbd5e1, | ||
// slate 500 | ||
'muted-text-color': #64748b, | ||
// red 600 | ||
'inline-code-color': #dc2626, | ||
// amber 200 | ||
'highlight-color': #fde68a, | ||
// slate 900 | ||
'footer-color': #0f172a, | ||
), | ||
'dark': ( | ||
// cyan 600 | ||
'accent-color': #0891b2, | ||
// cyan 500 | ||
'hover-over-accent-color': #06b6d4, | ||
// zinc 200 | ||
'text-over-accent-color': #e4e4e7, | ||
// gray-800 | ||
'bg-primary': #1f2937, | ||
// slate 900 | ||
'bg-primary-inverse': #0f172a, | ||
// gray 900 | ||
'bg-secondary': #111827, | ||
// slate 800 | ||
'bg-card': #1e293b, | ||
// slate 100 | ||
'heading-color': #f1f5f9, | ||
// slate 300 | ||
'text-color': #cbd5e1, | ||
// slate 900 | ||
'inverse-text-color': #0f172a, | ||
// slate 500 | ||
'muted-text-color': #64748b, | ||
// red 600 | ||
'inline-code-color': #dc2626, | ||
// amber 200 | ||
'highlight-color': #fde68a, | ||
// slate 900 | ||
'footer-color': #0f172a, | ||
), | ||
); | ||
``` | ||
|
||
The `light` and `dark` fields in the color mappings represent the color schemes for light mode and dark mode, respectively. By modifying the color codes in these fields, you can customize the look and feel of your site. | ||
|
||
## Override Component CSS | ||
|
||
To override the CSS of a component, create a `override.scss` file in your site's `assets/styles` directory. Then, put the new CSS for the component there. You don't have to re-write the entire CSS of the component. You can just put the changed fields. | ||
|
||
For example, to disable blur effect of the background image on the home page, you can add the following SCSS code in your `override.scss` file: | ||
|
||
```scss | ||
.home{ | ||
.background{ | ||
filter: none; | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,47 @@ | ||
--- | ||
title: "How to add a new section" | ||
date: 2020-06-07T06:20:50+06:00 | ||
hero: /images/posts/configuration/about-section-hero.svg | ||
title: "Adding a new section" | ||
date: 2024-01-13T22:30:50+06:00 | ||
author: | ||
name: Emruz Hossain | ||
image: images/author/emruz.jpg | ||
menu: | ||
sidebar: | ||
name: Adding New Section | ||
identifier: customizing-add-new-section | ||
parent: customizing | ||
weight: 410 | ||
weight: 415 | ||
--- | ||
|
||
## Coming soon....... | ||
If the default sections, templates, and components do not meet your needs, you can easily add new sections, templates, and components to your site. This guide will demonstrate how to add a new section to your site. | ||
|
||
### Step 1 : Add Layout File | ||
|
||
To add a new section to your site, you need to create a layout file in the `layouts/partials/sections` directory. The file should be named after the section's name. For example, if you want to add a `contact` section with a contact form, create a file named `contact.html`. Use the following template for the `contact.html` file: | ||
|
||
```html | ||
{{ $sectionID := replace (lower .section.name) " " "-" }} | ||
{{ if .section.id }} | ||
{{ $sectionID = .section.id }} | ||
{{ end }} | ||
|
||
<div class="container anchor p-lg-5 about-section" id="{{ $sectionID }}"> | ||
// Your custom HTML code here | ||
</div> | ||
``` | ||
|
||
### Step 2: Add CSS Styles | ||
|
||
If you want to add custom CSS for your new section, you can do so by adding the CSS code to the `assets/styles/override.scss` file in your site. This file is automatically loaded by the theme and will apply the custom styles. Alternatively, you can create a separate SCSS file in the `assets/styles directory` of your repository and include it in the `assets/styles/override.scss` file using the following syntax: | ||
|
||
```scss | ||
@import "your-style-file-name"; | ||
``` | ||
|
||
### Step 3: Add JavaScript | ||
|
||
Similarly, if your new section requires additional JavaScript, the recommended way is to add the JavaScript in the layout file itself with `<script>` tag. If you want to add the JavaScript in a separate file, then put the JavaScript file in `assets/scripts` directory of your repo and include it in the layout file as following: | ||
|
||
```html | ||
{{ $script := resources.Get "scripts/your-script.js" }} | ||
<script src="{{ $script.RelPermalink }}" integrity="{{ $script.Data.Integrity }}"></script> | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters