Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to change colors in config.toml #758

Closed
JoshuaKissel opened this issue May 13, 2020 · 12 comments
Closed

Unable to change colors in config.toml #758

JoshuaKissel opened this issue May 13, 2020 · 12 comments
Labels

Comments

@JoshuaKissel
Copy link

Is this a BUG REPORT or FEATURE REQUEST?:
bug

What happened:
Attempting to change the color option in the config.tolm file. When I change and save the file I am given the error
.File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}
and the color does not change. Not sure what to wrap with if or with.

What you expected to happen:
I expected that changing the color code in config.toml would change the color in the site.

Environment:

  • Syna Theme version:
  • Hugo version:
  • Others:
@stp-ip
Copy link
Member

stp-ip commented May 13, 2020

The site works without changing the color?
What theme version are you using?
What hugo version are you using?
Are you using the starter repo from https://github.com/okkur/syna-start?

The zero object warning is usually just a warning and shouldn't impact site rendering and all the warnings should have been fixed. Related issue: #728

The color change seems to work in my tests. Would be great, if you can show the config you are trying to use to change the colors. Some additional docs would be great. Related issue: #750

@JoshuaKissel
Copy link
Author

JoshuaKissel commented May 13, 2020

The site works without changing the color?

Yes

What theme version are you using?

version = "0.17.0"

What hugo version are you using?

v0.69.2-EC9DCF30

Are you using the starter repo from https://github.com/okkur/syna-start?

Yes

The zero object warning is usually just a warning and shouldn't impact site rendering and all the warnings should have been fixed. Related issue: #728

The color change seems to work in my tests. Would be great, if you can show the config you are trying to use to change the colors. Some additional docs would be great. Related issue: #750

Example: in the config.toml file I changed
primary = "#00838F"
to
primary = "#0000FF"
and receive the warning
`".File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}".'
Any fragments that had
'background = "primary"'
render as the original #00838F color and not #0000FF.

@IvanTurgenev
Copy link

save some headaches
hugo server -D --disableFastRender

@stp-ip
Copy link
Member

stp-ip commented May 14, 2020

@IvanTurgenev sidenote on that comment. Our use of fragments and partials seems to be suboptimal with the Hugo cache changes so might be a generally good thing to add to documented commands.

@stp-ip
Copy link
Member

stp-ip commented May 14, 2020

@JoshuaKissel Cleaned up the comment to make it more readable. Github flavored markdown needs whitespace between the end of a comment declarated by > and the response or it will formatted as being part of the comment.

Will try to recreate the issue locally. Thanks for the info.

@JoshuaKissel
Copy link
Author

I was wondering if this has been solved yet- I am running syna version 0.17.3 on hugo 0.74.3.
In the config.toml file I see a list of param.colors:
param color
I would assume that changing the hex code (ie from "primary = #000000" to "primary = #ffffff") would change the color associated with that name, but no change occurs. Am I changing this in the correct file?

@stp-ip
Copy link
Member

stp-ip commented Aug 26, 2020

@JoshuaKissel Are you running with the extended version? This is necessary to rebuild the CSS assets, which would incorporate these styling changes.

@JoshuaKissel
Copy link
Author

@stp-ip I don't believe so, is there a way to check that? Could you explain what the extended version is more? I'm still pretty new to this.

@stp-ip
Copy link
Member

stp-ip commented Aug 27, 2020

You can run hugo version, which should show something along the lines of v0.74.1-15163266/extended, if it is the extended version.

Hugo basically ships in 2 versions. One can't recompile specific assets such as CSS and JS and uses pre-compile ones including the pre-compiled colors (non extended) and the other can recompile the CSS including the colors.

The Hugo extended version is available here as well: https://github.com/gohugoio/hugo/releases

You would also currently need postcss-cli until this issue is merged and release, which is currently a bit delayed: #816

@JoshuaKissel
Copy link
Author

Was able to get this to work by following @stp-ip instructions. Download and install the extended version of Hugo, download newest version of Syna, install postcss-cli (if on windows follow the install process for npm then in powershell run npm install -g postcss-cli to install postcss-cli.) I was then able to change the color hex number and effect the background colors on my localhost.

Not sure if instructions like this are allowed - figured it would help others.

@stp-ip
Copy link
Member

stp-ip commented Aug 28, 2020

Sure. Don't use windows myself. So that sounds good. The need for postcss-cli should be removed with #816 merged, but there is still a blocker as the test server is having issues.

Closing this for now as it is working as you mentioned.

@0xffset
Copy link

0xffset commented Sep 30, 2020

Hi, I had the same issue. To solved just I installed postcss with npm install postcss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants