From 2099e20cb1fd0f7d4e5b1aa24d10f2abda52f6ae Mon Sep 17 00:00:00 2001 From: Ritesh Date: Thu, 27 Jun 2024 17:21:31 +0530 Subject: [PATCH 1/8] Add files via upload --- .../Macro-Nutrient-Calculator/index.html | 72 +++++++++++ .../Macro-Nutrient-Calculator/script.js | 77 +++++++++++ .../Macro-Nutrient-Calculator/styles.css | 122 ++++++++++++++++++ 3 files changed, 271 insertions(+) create mode 100644 Calculators/Macro-Nutrient-Calculator/index.html create mode 100644 Calculators/Macro-Nutrient-Calculator/script.js create mode 100644 Calculators/Macro-Nutrient-Calculator/styles.css diff --git a/Calculators/Macro-Nutrient-Calculator/index.html b/Calculators/Macro-Nutrient-Calculator/index.html new file mode 100644 index 000000000..99f69e8f3 --- /dev/null +++ b/Calculators/Macro-Nutrient-Calculator/index.html @@ -0,0 +1,72 @@ + + + + + + Macronutrient Calculator + + + +
+

Macronutrient Calculator

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + + diff --git a/Calculators/Macro-Nutrient-Calculator/script.js b/Calculators/Macro-Nutrient-Calculator/script.js new file mode 100644 index 000000000..3c1bbfa46 --- /dev/null +++ b/Calculators/Macro-Nutrient-Calculator/script.js @@ -0,0 +1,77 @@ +document.getElementById("calculate").addEventListener("click", function() { + const weight = parseFloat(document.getElementById("weight").value); + const height = parseFloat(document.getElementById("height").value); + const age = parseInt(document.getElementById("age").value); + const gender = document.getElementById("gender").value; + const activity = document.getElementById("activity").value; + const goal = document.getElementById("goal").value; + + if (isNaN(weight) || isNaN(height) || isNaN(age)) { + alert("Please enter valid numbers for weight, height, and age."); + return; + } + + // Basal Metabolic Rate (BMR) calculation using the Mifflin-St Jeor Equation + let bmr; + if (gender === "male") { + bmr = 10 * weight + 6.25 * height - 5 * age + 5; + } else { + bmr = 10 * weight + 6.25 * height - 5 * age - 161; + } + + // Adjust BMR based on activity level + let calories; + switch (activity) { + case "sedentary": + calories = bmr * 1.2; + break; + case "light": + calories = bmr * 1.375; + break; + case "moderate": + calories = bmr * 1.55; + break; + case "active": + calories = bmr * 1.725; + break; + case "very_active": + calories = bmr * 1.9; + break; + } + + // Adjust calories based on fitness goal + switch (goal) { + case "maintenance": + break; + case "weight_loss": + calories -= 500; + break; + case "muscle_gain": + calories += 500; + break; + } + + // Calculate macronutrients + const protein = weight * 2.2; // grams of protein per kg of body weight + const fat = (calories * 0.25) / 9; // 25% of calories from fat + const carbs = (calories - (protein * 4) - (fat * 9)) / 4; // remaining calories from carbs + + // Display results + document.getElementById("calories").value = Math.round(calories); + document.getElementById("protein").value = Math.round(protein); + document.getElementById("carbs").value = Math.round(carbs); + document.getElementById("fat").value = Math.round(fat); +}); + +document.getElementById("reset").addEventListener("click", function() { + document.getElementById("weight").value = ""; + document.getElementById("height").value = ""; + document.getElementById("age").value = ""; + document.getElementById("gender").value = "male"; + document.getElementById("activity").value = "sedentary"; + document.getElementById("goal").value = "maintenance"; + document.getElementById("calories").value = ""; + document.getElementById("protein").value = ""; + document.getElementById("carbs").value = ""; + document.getElementById("fat").value = ""; +}); diff --git a/Calculators/Macro-Nutrient-Calculator/styles.css b/Calculators/Macro-Nutrient-Calculator/styles.css new file mode 100644 index 000000000..981d359e9 --- /dev/null +++ b/Calculators/Macro-Nutrient-Calculator/styles.css @@ -0,0 +1,122 @@ +@import url('https://fonts.googleapis.com/css2?family=Alfa+Slab+One&display=swap'); + +* { + padding: 0; + margin: 0; + box-sizing: border-box; +} + +body { + font-family: 'Inconsolata', monospace; + justify-content: center; + display: flex; + flex-direction: column; + align-items: center; + text-align: center; + background: linear-gradient(to right bottom, #7ed0e7, #77c1ee, #87afee, #a399e1, #bf80c6); + min-height: 100vh; + margin: 0; +} + +.container { + padding: 20px; + width: 100%; + max-width: 600px; + margin: auto; +} + +h1 { + color: #fff; + font-family: 'Alfa Slab One', cursive; + font-weight: 100; + margin-bottom: 20px; + font-size: 2.5rem; + text-align: center; +} + +.card { + background: rgba(46, 123, 225, 0.1); + backdrop-filter: blur(10px); + border-radius: 15px; + padding: 20px; + text-align: center; + width: 100%; + margin-bottom: 20px; +} + +.input { + margin-bottom: 10px; + text-align: left; +} + +.input label { + display: block; + margin-bottom: 5px; + color: #fff; +} + +.input input, +.input select { + width: calc(100% - 16px); + padding: 8px; + border-radius: 4px; + border: 1px solid #ccc; +} + +button { + align-items: center; + appearance: none; + background-image: radial-gradient(100% 100% at 100% 0, #d7bb7e 0, #7e88d1 100%); + border: 0; + border-radius: 6px; + box-shadow: rgba(45, 35, 66, .4) 0 2px 4px, rgba(45, 35, 66, .3) 0 7px 13px -3px, rgba(58, 65, 111, .5) 0 -3px 0 inset; + box-sizing: border-box; + color: #fff; + cursor: pointer; + display: inline-flex; + font-family: "JetBrains Mono", monospace; + height: 40px; + justify-content: center; + line-height: 1; + list-style: none; + overflow: hidden; + padding-left: 16px; + padding-right: 16px; + position: relative; + text-align: left; + text-decoration: none; + transition: box-shadow .15s, transform .15s; + user-select: none; + white-space: nowrap; + will-change: box-shadow, transform; + font-size: 18px; + margin: 5px; +} + +button:hover { + box-shadow: rgba(45, 35, 66, .4) 0 4px 8px, rgba(45, 35, 66, .3) 0 7px 13px -3px, #2a0f5a 0 -3px 0 inset; + transform: translateY(-2px); +} + +button:active { + box-shadow: #ccabeb 0 3px 7px inset; + transform: translateY(2px); +} + +.result { + margin-top: 10px; +} + +.result label { + display: block; + margin-bottom: 5px; + color: #fff; +} + +.result input { + width: calc(100% - 16px); + padding: 8px; + border-radius: 4px; + border: 1px solid #ccc; + background-color: #f9f9f9; +} From a9a44ffe2e94bbb02e810727d9148415f47c399f Mon Sep 17 00:00:00 2001 From: Ritesh Date: Thu, 27 Jun 2024 17:26:00 +0530 Subject: [PATCH 2/8] Create README.md --- .../Macro-Nutrient-Calculator/README.md | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Calculators/Macro-Nutrient-Calculator/README.md diff --git a/Calculators/Macro-Nutrient-Calculator/README.md b/Calculators/Macro-Nutrient-Calculator/README.md new file mode 100644 index 000000000..afb56e034 --- /dev/null +++ b/Calculators/Macro-Nutrient-Calculator/README.md @@ -0,0 +1,38 @@ +# Macronutrient Calculator + +The Macronutrient Calculator is a simple and effective tool designed to help users determine their daily macronutrient needs based on personal fitness goals and activity levels. By entering a few key details about themselves, users can receive a tailored recommendation for their daily caloric intake and the amount of protein, carbohydrates, and fats they should consume to achieve their fitness objectives. + +## Key Features + +### User Inputs +- **Weight (kg)**: The user's body weight in kilograms. +- **Height (cm)**: The user's height in centimeters. +- **Age**: The user's age. +- **Gender**: The user's gender, which impacts the Basal Metabolic Rate (BMR) calculation. +- **Activity Level**: The user's daily activity level, ranging from sedentary to very active. +- **Fitness Goal**: The user's fitness goal, which can be maintenance, weight loss, or muscle gain. + +### Calculations +- **Basal Metabolic Rate (BMR)**: Calculated using the Mifflin-St Jeor Equation, adjusted for gender. +- **Total Daily Energy Expenditure (TDEE)**: Adjusted BMR based on the user's activity level. +- **Macronutrient Breakdown**: + - **Protein**: Calculated based on the user's weight. + - **Fat**: A percentage of the total caloric intake. + - **Carbohydrates**: The remaining calories after accounting for protein and fat. + +### Output +- Daily caloric intake (kcal/day). +- Daily protein intake (g/day). +- Daily carbohydrate intake (g/day). +- Daily fat intake (g/day). + +### User-Friendly Interface +- Simple and intuitive layout. +- Responsive design for use on various devices. +- Clear input fields and results display. + +### Additional Functions +- **Calculate Button**: Computes and displays the macronutrient needs based on the inputs. +- **Reset Button**: Clears all inputs and results, allowing for a new calculation. + +This tool is ideal for anyone looking to optimize their diet according to their personal fitness goals, whether they're aiming to maintain their current weight, lose weight, or gain muscle. The calculator provides a quick and easy way to understand how much of each macronutrient you should be consuming daily, helping you make informed dietary decisions. From f90db60ddda9c946b11d9610520bab5c317c6a20 Mon Sep 17 00:00:00 2001 From: Ritesh Date: Thu, 27 Jun 2024 17:29:08 +0530 Subject: [PATCH 3/8] Update README.md --- Calculators/Macro-Nutrient-Calculator/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Calculators/Macro-Nutrient-Calculator/README.md b/Calculators/Macro-Nutrient-Calculator/README.md index afb56e034..70cc16fbe 100644 --- a/Calculators/Macro-Nutrient-Calculator/README.md +++ b/Calculators/Macro-Nutrient-Calculator/README.md @@ -31,6 +31,10 @@ The Macronutrient Calculator is a simple and effective tool designed to help use - Responsive design for use on various devices. - Clear input fields and results display. +### Screenshots +![Image](https://github.com/Antiquely3059/CalcDiverse/assets/112797055/f2e6311c-4f3b-467c-a347-066faa713211) + + ### Additional Functions - **Calculate Button**: Computes and displays the macronutrient needs based on the inputs. - **Reset Button**: Clears all inputs and results, allowing for a new calculation. From cc63741b0901e594d64189cbe6163a0bd05041e1 Mon Sep 17 00:00:00 2001 From: Ritesh Date: Thu, 27 Jun 2024 17:36:36 +0530 Subject: [PATCH 4/8] Update index.html --- index.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/index.html b/index.html index be8b1a4a2..3dc68d636 100644 --- a/index.html +++ b/index.html @@ -2220,6 +2220,20 @@

Calculates a percentage score of love compatibility based on names or birthd +
+
+

Macro Nutrient Calculator

+

Calculates an individuals daily macronutrient needs based on personal fitness goals and activity levels.

+ +
+

Magic Number Calculator

From a7a3756914a2f7a7289c0957a9e622037dac90d7 Mon Sep 17 00:00:00 2001 From: Rakesh Roshan Date: Fri, 28 Jun 2024 11:58:15 +0530 Subject: [PATCH 5/8] Update README.md --- .../Macro-Nutrient-Calculator/README.md | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/Calculators/Macro-Nutrient-Calculator/README.md b/Calculators/Macro-Nutrient-Calculator/README.md index 70cc16fbe..ba6104f7a 100644 --- a/Calculators/Macro-Nutrient-Calculator/README.md +++ b/Calculators/Macro-Nutrient-Calculator/README.md @@ -1,10 +1,21 @@ -# Macronutrient Calculator +#

Macro Nutrient Calculator

-The Macronutrient Calculator is a simple and effective tool designed to help users determine their daily macronutrient needs based on personal fitness goals and activity levels. By entering a few key details about themselves, users can receive a tailored recommendation for their daily caloric intake and the amount of protein, carbohydrates, and fats they should consume to achieve their fitness objectives. +## Description :- -## Key Features +The Macronutrient Calculator is a simple and effective tool designed to help users determine their daily macronutrient needs based on personal fitness goals and activity levels. By entering a few key details about themselves, users can receive a tailored recommendation for their daily caloric intake and the amount of protein, carbohydrates, and fats they should consume to achieve their fitness objectives.
+ +This tool is ideal for anyone looking to optimize their diet according to their personal fitness goals, whether they're aiming to maintain their current weight, lose weight, or gain muscle. The calculator provides a quick and easy way to understand how much of each macronutrient you should be consuming daily, helping you make informed dietary decisions. + +## Tech Stacks :- + +- HTML +- CSS +- JavaScript + +## Key Features :- + +### User Inputs :- -### User Inputs - **Weight (kg)**: The user's body weight in kilograms. - **Height (cm)**: The user's height in centimeters. - **Age**: The user's age. @@ -12,7 +23,8 @@ The Macronutrient Calculator is a simple and effective tool designed to help use - **Activity Level**: The user's daily activity level, ranging from sedentary to very active. - **Fitness Goal**: The user's fitness goal, which can be maintenance, weight loss, or muscle gain. -### Calculations +### Calculations :- + - **Basal Metabolic Rate (BMR)**: Calculated using the Mifflin-St Jeor Equation, adjusted for gender. - **Total Daily Energy Expenditure (TDEE)**: Adjusted BMR based on the user's activity level. - **Macronutrient Breakdown**: @@ -20,23 +32,13 @@ The Macronutrient Calculator is a simple and effective tool designed to help use - **Fat**: A percentage of the total caloric intake. - **Carbohydrates**: The remaining calories after accounting for protein and fat. -### Output +### Output :- + - Daily caloric intake (kcal/day). - Daily protein intake (g/day). - Daily carbohydrate intake (g/day). - Daily fat intake (g/day). -### User-Friendly Interface -- Simple and intuitive layout. -- Responsive design for use on various devices. -- Clear input fields and results display. - -### Screenshots -![Image](https://github.com/Antiquely3059/CalcDiverse/assets/112797055/f2e6311c-4f3b-467c-a347-066faa713211) +## Screenshots :- - -### Additional Functions -- **Calculate Button**: Computes and displays the macronutrient needs based on the inputs. -- **Reset Button**: Clears all inputs and results, allowing for a new calculation. - -This tool is ideal for anyone looking to optimize their diet according to their personal fitness goals, whether they're aiming to maintain their current weight, lose weight, or gain muscle. The calculator provides a quick and easy way to understand how much of each macronutrient you should be consuming daily, helping you make informed dietary decisions. +![image](https://github.com/Rakesh9100/CalcDiverse/assets/73993775/8691d754-cee9-4b3e-a05f-b7f591329c2c) From 34cc174914bf473c9f029fb72c568d891cab1813 Mon Sep 17 00:00:00 2001 From: Rakesh Roshan Date: Fri, 28 Jun 2024 11:58:34 +0530 Subject: [PATCH 6/8] Update index.html --- Calculators/Macro-Nutrient-Calculator/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Calculators/Macro-Nutrient-Calculator/index.html b/Calculators/Macro-Nutrient-Calculator/index.html index 99f69e8f3..974fdb5c9 100644 --- a/Calculators/Macro-Nutrient-Calculator/index.html +++ b/Calculators/Macro-Nutrient-Calculator/index.html @@ -3,8 +3,8 @@ - Macronutrient Calculator - + + Macro Nutrient Calculator
From 6b346ad19c42f608871b9d75d53da17a141af31e Mon Sep 17 00:00:00 2001 From: Rakesh Roshan Date: Fri, 28 Jun 2024 11:58:55 +0530 Subject: [PATCH 7/8] Update and rename styles.css to style.css --- Calculators/Macro-Nutrient-Calculator/{styles.css => style.css} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Calculators/Macro-Nutrient-Calculator/{styles.css => style.css} (100%) diff --git a/Calculators/Macro-Nutrient-Calculator/styles.css b/Calculators/Macro-Nutrient-Calculator/style.css similarity index 100% rename from Calculators/Macro-Nutrient-Calculator/styles.css rename to Calculators/Macro-Nutrient-Calculator/style.css From 5359a076be1e40d28a5cf8d72fd27a0053658055 Mon Sep 17 00:00:00 2001 From: Rakesh Roshan Date: Fri, 28 Jun 2024 11:59:34 +0530 Subject: [PATCH 8/8] Update index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 3dc68d636..92e028b69 100644 --- a/index.html +++ b/index.html @@ -2223,7 +2223,7 @@

Calculates a percentage score of love compatibility based on names or birthd

Macro Nutrient Calculator

-

Calculates an individuals daily macronutrient needs based on personal fitness goals and activity levels.

+

Calculates an individual's daily macronutrient needs based on personal fitness goals and activity levels.