Skip to content

Commit

Permalink
Merge pull request #33 from afucher/fix-color-settings
Browse files Browse the repository at this point in the history
Fix color settings
  • Loading branch information
afucher authored Feb 23, 2021
2 parents 1d0d8fc + 87e815c commit a32356c
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astrochart",
"version": "2.0.0",
"version": "2.0.1",
"description": "A free and open-source JavaScript library for generating SVG charts to display planets in astrology.",
"keywords": [
"astrology",
Expand Down
1 change: 1 addition & 0 deletions project/build/astrochart.js
Original file line number Diff line number Diff line change
Expand Up @@ -1686,6 +1686,7 @@

if(settings){
Object.assign(astrology, settings);
if(!('COLORS_SIGNS' in settings)) astrology.COLORS_SIGNS = [astrology.COLOR_ARIES, astrology.COLOR_TAURUS, astrology.COLOR_GEMINI, astrology.COLOR_CANCER, astrology.COLOR_LEO, astrology.COLOR_VIRGO, astrology.COLOR_LIBRA, astrology.COLOR_SCORPIO, astrology.COLOR_SAGITTARIUS, astrology.COLOR_CAPRICORN, astrology.COLOR_AQUARIUS, astrology.COLOR_PISCES];
}

if (elementId && !document.getElementById( elementId )){
Expand Down
6 changes: 3 additions & 3 deletions project/build/astrochart.min.js

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions project/examples/radix/radix_custom_settings.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Radix</title>
<style>
#paper{
background:#999;
}
</style>
</head>
<body>
<div id="paper"></div>

<script src="../../build/astrochart.js"></script>
<script type="text/javascript">

var data = {
"planets":{"Lilith":[18], "Chiron":[18], "Pluto":[63], "Neptune":[110, 0.2], "Uranus":[318], "Saturn":[201, -0.2], "Jupiter":[192], "Mars":[210], "Moon":[268], "Sun":[281], "Mercury":[312], "Venus":[330], "NNode":[2]},
"cusps":[296, 350, 30, 56, 75, 94, 116, 170, 210, 236, 255, 274]
};


//The colors can be set all in an array
var settings = {COLORS_SIGNS: ["#F00000", "#F0F0F0", "#00F000", "#F006F0", "#0000F0", "#113311", "#F00000", "#F0F0F0", "#00F000", "#F006F0", "#0000F0", "#113311"]};

//Or you can pass them separately
/*var settings = {COLOR_ARIES : "#F00000",
COLOR_TAURUS : "#F0F0F0",
COLOR_GEMINI: "#00F000",
COLOR_CANCER : "#F006F0",
COLOR_LEO : "#0000F0",
COLOR_VIRGO : "#113311",
COLOR_LIBRA : "#F00000",
COLOR_SCORPIO : "#F0F0F0",
COLOR_SAGITTARIUS : "#00F000",
COLOR_CAPRICORN : "#F006F0",
COLOR_AQUARIUS : "#0000F0",
COLOR_PISCES : "#113311"}*/

window.onload = function () {
var radix = new astrology.Chart('paper', 600, 600, settings).radix( data );
};
</script>
</body>
</html>

1 change: 1 addition & 0 deletions project/src/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

if(settings){
Object.assign(astrology, settings);
if(!('COLORS_SIGNS' in settings)) astrology.COLORS_SIGNS = [astrology.COLOR_ARIES, astrology.COLOR_TAURUS, astrology.COLOR_GEMINI, astrology.COLOR_CANCER, astrology.COLOR_LEO, astrology.COLOR_VIRGO, astrology.COLOR_LIBRA, astrology.COLOR_SCORPIO, astrology.COLOR_SAGITTARIUS, astrology.COLOR_CAPRICORN, astrology.COLOR_AQUARIUS, astrology.COLOR_PISCES];
}

if (elementId && !document.getElementById( elementId )){
Expand Down

0 comments on commit a32356c

Please sign in to comment.