├── .github └── dracula-pro.png ├── CONTRIBUTORS.md ├── INSTALL.md ├── LICENSE ├── README.md ├── sample ├── Dracula.yml ├── SAMPLE.md ├── dracula.c ├── dracula.c++ ├── dracula.clj ├── dracula.cs ├── dracula.css ├── dracula.dart ├── dracula.ex ├── dracula.go ├── dracula.html ├── dracula.java ├── dracula.js ├── dracula.kt ├── dracula.md ├── dracula.php ├── dracula.py ├── dracula.rb ├── dracula.rs ├── dracula.scala ├── dracula.sml ├── dracula.swift └── dracula.ts └── screenshot.png /.github/dracula-pro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dracula/template/291aa546dbf6e95ba4eabec737df8d348125c379/.github/dracula-pro.png -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | # 🤝🏻 Contributors 2 | 3 | > "We learn big things from small experiences" - **Bram Stoker** 4 | 5 | Dracula Theme is an open-source project driven by and for the community. Most apps that support the theme are contributions from our community. 6 | 7 | As much as the team is responsible for the core theme and wants to support all available applications, we can only do some of it ourselves. 8 | 9 | That's why the community is essential for this project to keep evolving. Below are some tips for you, contributor. 10 | 11 | ## 🎃 Recommendations 12 | 13 | ⚡ This template-repo is organized for easy use: 14 | 15 | - [`README.md`](README.md): Introduction and guide for GitHub users; 16 | - [`screenshot.png`](screenshot.png): Displays your Dracula-themed theme on the website 😅; 17 | - [`INSTALL.md`](INSTALL.md): Installation instructions to display on the website; 18 | - [`sample`](/sample/): Code samples in various languages to aid theme creation. (_Consider removing this folder before submission._) 19 | 20 | Previously, default formatting settings were included. Now, we recommend preparing your theme with this command: 21 | 22 | ```bash 23 | npx prettier . --write 24 | ``` 25 | 26 | > What is that `npx` thing? `npx` ships with `npm` and lets you run locally installed tools. 27 | 28 | ## 🦉 The Dracula Theme Team 29 | 30 | The creators behind the scenes are just me, [Lucas de França](https://github.com/luxonauta), and [Zeno Rocha](https://github.com/zenorocha). 😅 31 | 32 | Reach out via [email](mailto:support@draculatheme.com) or follow us on Twitter/X: [Zeno Rocha](https://twitter.com/zenorocha) & [Luxonauta (Lucas)](https://twitter.com/luxonauta). 33 | -------------------------------------------------------------------------------- /INSTALL.md: -------------------------------------------------------------------------------- 1 | ### [Foobar](https://foobar.com) 2 | 3 | #### Install using Git 4 | 5 | If you are a git user, you can install the theme and keep up to date by cloning the repo: 6 | 7 | ```bash 8 | git clone https://github.com/dracula/foobar.git 9 | ``` 10 | 11 | #### Install manually 12 | 13 | Download using the [GitHub `.zip` download](https://github.com/dracula/foobar/archive/main.zip) option and unzip them. 14 | 15 | #### Activating theme 16 | 17 | 1. Do this; 18 | 2. Then that; 19 | 3. Boom! It's working ✨ 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Dracula Theme 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dracula for [Foobar](https://foobar.com) 2 | 3 | > A dark theme for [Foobar](https://foobar.com). 4 | 5 | ![Screenshot](./screenshot.png) 6 | 7 | ## Install 8 | 9 | All instructions can be found at [draculatheme.com/foobar](https://draculatheme.com/foobar). 10 | 11 | ## Team 12 | 13 | This theme is maintained by the following person(s) and a bunch of [awesome contributors](https://github.com/dracula/foobar/graphs/contributors). 14 | 15 | | [![Zeno Rocha](https://github.com/zenorocha.png?size=100)](https://github.com/zenorocha) | [![Lucas de França](https://github.com/luxonauta.png?size=100)](https://github.com/luxonauta) | 16 | | ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | 17 | | [Zeno Rocha](https://github.com/zenorocha) | [Lucas de França](https://github.com/luxonauta) | 18 | 19 | ## Community 20 | 21 | - [Twitter](https://twitter.com/draculatheme) - Best for getting updates about themes and new stuff. 22 | - [GitHub](https://github.com/dracula/dracula-theme/discussions) - Best for asking questions and discussing issues. 23 | - [Discord](https://draculatheme.com/discord-invite) - Best for hanging out with the community. 24 | 25 | ## Dracula PRO 26 | 27 | [![Dracula PRO](./.github/dracula-pro.png)](https://draculatheme.com/pro) 28 | 29 | ## License 30 | 31 | [MIT License](./LICENSE) 32 | -------------------------------------------------------------------------------- /sample/Dracula.yml: -------------------------------------------------------------------------------- 1 | name: Dracula 2 | spec: # https://spec.draculatheme.com 3 | # Base https://draculatheme.com/contribute#color-palette 4 | background: &BACKGROUND "#282A36" 5 | foreground: &FOREGROUND "#F8F8F2" # 07 6 | selection: &SELECTION "#44475A" 7 | comment: &COMMENT "#6272A4" 8 | cyan: &CYAN "#8BE9FD" # 06 9 | green: &GREEN "#50FA7B" # 02 10 | orange: &ORANGE "#FFB86C" 11 | pink: &PINK "#FF79C6" 12 | purple: &PURPLE "#BD93F9" 13 | red: &RED "#F55" # 01 14 | yellow: &YELLOW "#F1FA8C" # 03 15 | 16 | # ANSI 0–15 https://spec.draculatheme.com#sec-ANSI 17 | black: &BLACK "#21222C" # 00 18 | blue: &BLUE "#BD93F9" # 04 19 | magenta: &MAGENTA "#FF79C6" # 05 20 | bright_black: &BRIGHT_BLACK "#6272A4" # 08 21 | bright_red: &BRIGHT_RED "#FF6E6E" # 09 22 | bright_green: &BRIGHT_GREEN "#69FF94" # 10 23 | bright_yellow: &BRIGHT_YELLOW "#FFFFA5" # 11 24 | bright_blue: &BRIGHT_BLUE "#D6ACFF" # 12 25 | bright_magenta: &BRIGHT_MAGENTA "#FF92DF" # 13 26 | bright_cyan: &BRIGHT_CYAN "#A4FFFF" # 14 27 | bright_white: &BRIGHT_WHITE "#FFF" # 15 28 | -------------------------------------------------------------------------------- /sample/SAMPLE.md: -------------------------------------------------------------------------------- 1 | # Sample 2 | 3 | In order to improve the quality of our screenshots, we created this folder with standardized code snippets. 4 | 5 | ## Instructions 6 | 7 | After you're done taking a screenshot, feel free to delete this `sample` folder. 8 | 9 | ## Why this is cool? 10 | 11 | - It contains examples of string, number, and array 12 | - It contains examples of single line and multi-line comments 13 | - It contains examples of inheritance and functions 14 | - It's simple, funny, and silly :) 15 | 16 | ## Is there a programming language missing? 17 | 18 | Feel free to send a pull request. This will help new theme authors to create awesome screenshots. 19 | -------------------------------------------------------------------------------- /sample/dracula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct Vampire { 4 | char *location; 5 | int birthday; 6 | int deathdate; 7 | char *weaknesses[2]; 8 | }; 9 | 10 | int _calcAge(struct Vampire *v) { return v->deathdate - v->birthday; } 11 | 12 | int get_age(struct Vampire *v) { return _calcAge(v); } 13 | 14 | int main() { 15 | struct Vampire v; 16 | 17 | /* There was a guy named Vlad */ 18 | v.location = malloc(12 * sizeof(char)); 19 | v.location = "Transylvania"; 20 | v.birthday = 1428; 21 | v.deathdate = 1476; 22 | v.weaknesses[0] = "Sunlight"; 23 | v.weaknesses[1] = "Garlic"; 24 | 25 | get_age(&v); 26 | 27 | return 0; 28 | } -------------------------------------------------------------------------------- /sample/dracula.c++: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* 5 | * Once upon a time... 6 | */ 7 | 8 | class Vampire { 9 | public: 10 | Vampire(std::string location, int birth_date, int death_date, 11 | std::vector weaknesses) 12 | : _location{location}, 13 | _birth_date{birth_date}, 14 | _death_date{death_date}, 15 | _weaknesses{weaknesses} {} 16 | 17 | int age() { return calc_age(); } 18 | 19 | private: 20 | std::string _location; 21 | int _birth_date; 22 | int _death_date; 23 | std::vector _weaknesses; 24 | 25 | int calc_age() { return _death_date - _birth_date; } 26 | }; 27 | 28 | // ...there was a guy named Vlad 29 | 30 | int main() { 31 | std::string location = "Transylvania"; 32 | int birth_date = 1428, death_date = 1476; 33 | std::vector weaknesses { "Sunlight", "Garlic" }; 34 | 35 | Vampire dracula{location, birth_date, death_date, weaknesses}; 36 | 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /sample/dracula.clj: -------------------------------------------------------------------------------- 1 | (comment 2 | "Once upon a time...") 3 | 4 | (ns clj-dracula) 5 | 6 | (defstruct dracula :location :birth-date :death-date :weaknesses) 7 | 8 | (defn age 9 | [vamp] (- (vamp :death-date) (vamp :birth-date))) 10 | 11 | ;;...there was a guy named Vlad 12 | (let [d (struct dracula "Transylvania" 1428 1476 '("Sunlight", "Garlic"))] 13 | (println (age d))) -------------------------------------------------------------------------------- /sample/dracula.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Once upon a time... 3 | */ 4 | 5 | public class Vampire 6 | { 7 | public string Location { get; private set; } 8 | public int BirthDate { get; private set; } 9 | public int DeathDate { get; private set; } 10 | public string[] Weaknesses { get; private set; } 11 | 12 | public Vampire(string location, int birthDate, int deathDate, string[] weaknesses) 13 | { 14 | Location = location; 15 | BirthDate = birthDate; 16 | DeathDate = deathDate; 17 | Weaknesses = weaknesses; 18 | } 19 | 20 | public int Age() 21 | { 22 | return calcAge(); 23 | } 24 | 25 | private int calcAge() 26 | { 27 | return DeathDate - BirthDate; 28 | } 29 | } 30 | class Program 31 | { 32 | static void Main(string[] args) 33 | { 34 | // ...there was a guy named Vlad 35 | 36 | var vampire = new Vampire( 37 | "Transylvania", 38 | 1428, 39 | 1476, 40 | new string[] { "Sunlight", "Garlic" } 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /sample/dracula.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Once upon a time... 3 | */ 4 | 5 | :root { 6 | --birthDate: 1428px; 7 | --deathDate: 1476px; 8 | } 9 | 10 | body { 11 | background: #000; 12 | } 13 | 14 | /* ...there was a guy named Vlad */ 15 | 16 | #dracula { 17 | opacity: 0; 18 | display: none; 19 | visibility: hidden; 20 | font-family: "Transylvania"; 21 | height: calc(var(--deathDate) - var(--birthDate)); 22 | } 23 | 24 | .cape { 25 | background: #ff0000 !important; 26 | } 27 | 28 | @font-face { 29 | font-family: "Transylvania"; 30 | src: url("/location/Transylvania.woff2") format("woff2"); 31 | font-weight: 700; 32 | font-style: normal; 33 | } 34 | -------------------------------------------------------------------------------- /sample/dracula.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Once upon a time... 3 | */ 4 | 5 | class Vampire { 6 | String location; 7 | int birthDate, deathDate; 8 | List weaknesses; 9 | 10 | Vampire({this.location, this.birthDate, this.deathDate, this.weaknesses}); 11 | 12 | int get age => this.calcAge(); 13 | 14 | int calcAge() => this.deathDate - this.birthDate; 15 | } 16 | 17 | void main() { 18 | // ...there was a guy named Vlad 19 | final Dracula = Vampire( 20 | location: 'Transylvania', 21 | birthDate: 1428, 22 | deathDate: 1476, 23 | weaknesses: ['Sunlight', 'Garlic']); 24 | } -------------------------------------------------------------------------------- /sample/dracula.ex: -------------------------------------------------------------------------------- 1 | defmodule Vampire do 2 | @moduledoc """ 3 | Once upon a time... 4 | """ 5 | 6 | defstruct [:location, :birth_date, :death_date, :weaknesses] 7 | 8 | def new(props) do 9 | %__MODULE__{ 10 | location: props[:location], 11 | birth_date: props[:birth_date], 12 | death_date: props[:death_date], 13 | weaknesses: props[:weaknesses] 14 | } 15 | end 16 | 17 | def age(vampire) do 18 | calc_age(vampire) 19 | end 20 | 21 | defp calc_age(vampire) do 22 | vampire.death_date - vampire.birth_date 23 | end 24 | end 25 | 26 | # ...there was a guy named Vlad 27 | 28 | dracula = Vampire.new( 29 | location: "Transylvania", 30 | birthDate: 1428, 31 | deathDate: 1476, 32 | weaknesses: ["Sunlight", "Garlic"] 33 | ) 34 | -------------------------------------------------------------------------------- /sample/dracula.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | /* 6 | Once upon a time... 7 | */ 8 | type Vampire struct { 9 | Location string 10 | BirthDate int 11 | DeathDate int 12 | Weaknesses []string 13 | } 14 | 15 | func (v *Vampire) Age() int { 16 | return v.calcAge() 17 | } 18 | 19 | func (v *Vampire) calcAge() int { 20 | return v.DeathDate - v.BirthDate 21 | } 22 | 23 | // ...there was a guy named Vlad 24 | 25 | func main() { 26 | dracula := &Vampire{ 27 | Location: "Transylvania", 28 | BirthDate: 1428, 29 | DeathDate: 1476, 30 | Weaknesses: []string{"Sunlight", "Garlic"}, 31 | } 32 | 33 | fmt.Println(dracula.Age()) 34 | } 35 | -------------------------------------------------------------------------------- /sample/dracula.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Dracula 6 | 7 | 8 | 9 |

Vampires

10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /sample/dracula.java: -------------------------------------------------------------------------------- 1 | class Vampire { 2 | private String location; 3 | private int birthDate; 4 | private int deathDate; 5 | private String[] weaknesses; 6 | 7 | public Vampire(String location, int birthDate, int deathDate, String[] weaknesses) { 8 | this.location = location; 9 | this.birthDate = birthDate; 10 | this.deathDate = deathDate; 11 | this.weaknesses = weaknesses; 12 | } 13 | 14 | public int getAge() { 15 | return this.calcAge(); 16 | } 17 | 18 | public int calcAge() { 19 | return this.deathDate - this.birthDate; 20 | } 21 | } 22 | 23 | // ...there was a guy named Vlad 24 | public class dracula { 25 | Vampire vampire = new Vampire( 26 | "Transylvania", 27 | 1428, 28 | 1476, 29 | new String[] { "Sunlight", "Garlic" }); 30 | } -------------------------------------------------------------------------------- /sample/dracula.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Once upon a time... 3 | */ 4 | class Vampire { 5 | constructor(props) { 6 | this.location = props.location; 7 | this.birthDate = props.birthDate; 8 | this.deathDate = props.deathDate; 9 | this.weaknesses = props.weaknesses; 10 | } 11 | 12 | get age() { 13 | return this.calcAge(); 14 | } 15 | 16 | calcAge() { 17 | return this.deathDate - this.birthDate; 18 | } 19 | } 20 | 21 | // ...there was a guy named Vlad 22 | const Dracula = new Vampire({ 23 | location: "Transylvania", 24 | birthDate: 1428, 25 | deathDate: 1476, 26 | weaknesses: ["Sunlight", "Garlic"], 27 | }); 28 | -------------------------------------------------------------------------------- /sample/dracula.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Once upon a time ... 3 | */ 4 | 5 | class Vampire( 6 | val location: String, 7 | val birthDate: Int, 8 | val deathDate: Int, 9 | val weaknesses: Array 10 | ) { 11 | val age: Int 12 | get() = this.calcAge() 13 | 14 | fun calcAge() = 15 | this.deathDate - this.birthDate 16 | } 17 | 18 | // ... there was a guy named Vlad 19 | 20 | fun main() { 21 | Vampire( 22 | "Transylvania", 23 | 1428, 24 | 1476, 25 | arrayOf("Sunlight", "Garlic") 26 | ) 27 | } -------------------------------------------------------------------------------- /sample/dracula.md: -------------------------------------------------------------------------------- 1 | 4 | 5 | # Vampires 6 | 7 | | Name | Value | 8 | | ---------- | ---------------- | 9 | | location | Transylvania | 10 | | birth date | 1428 | 11 | | death date | 1476 | 12 | | weaknesses | Sunlight, Garlic | 13 | 14 | 15 | 16 | > The **age** is the `deathDate` minus the `birthDate` 17 | -------------------------------------------------------------------------------- /sample/dracula.php: -------------------------------------------------------------------------------- 1 | location = $props['location']; 13 | $this->birthDate = $props['birthDate']; 14 | $this->deathDate = $props['deathDate']; 15 | $this->weaknesses = $props['weaknesses']; 16 | } 17 | 18 | public function age(): int { 19 | return $this->calcAge(); 20 | } 21 | 22 | private function calcAge(): int { 23 | return $this->deathDate - $this->birthDate; 24 | } 25 | } 26 | 27 | // ...there was a guy named Vlad 28 | $Dracula = new Vampire([ 29 | 'location' => 'Transylvania', 30 | 'birthDate' => 1428, 31 | 'deathDate' => 1476, 32 | 'weaknesses' => ['Sunlight', 'Garlic'] 33 | ]); 34 | ?> 35 | -------------------------------------------------------------------------------- /sample/dracula.py: -------------------------------------------------------------------------------- 1 | # Once upon a time... 2 | 3 | class Vampire: 4 | def __init__(self, props): 5 | self.location = props['location'] 6 | self.birthDate = props['birthDate'] 7 | self.deathDate = props['deathDate'] 8 | self.weaknesses = props['weaknesses'] 9 | 10 | def get_age(self): 11 | return self.calc_age() 12 | 13 | def calc_age(self): 14 | return self.deathDate - self.birthDate 15 | 16 | # ...there was a guy named Vlad 17 | 18 | Dracula = Vampire({ 19 | 'location': 'Transylvania', 20 | 'birthDate': 1428, 21 | 'deathDate': 1476, 22 | 'weaknesses': ['Sunlight', 'Garlic'] 23 | }) -------------------------------------------------------------------------------- /sample/dracula.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Once upon a time... 3 | # 4 | 5 | class Vampire 6 | def initialize(opts) 7 | @location = opts[:location] 8 | @birthDate = opts[:birthDate] 9 | @deathDate = opts[:deathDate] 10 | @weaknesses = opts[:weaknesses] 11 | end 12 | 13 | def age 14 | calcAge 15 | end 16 | 17 | private 18 | 19 | def calcAge 20 | @deathDate - @birthDate 21 | end 22 | end 23 | 24 | # ...there was a guy named Vlad 25 | 26 | dracula = Vampire.new( 27 | location: 'Transylvania', 28 | birthDate: 1428, 29 | deathDate: 1476, 30 | weaknesses: %w[Sunlight Garlic] 31 | ) 32 | 33 | puts dracula.age 34 | -------------------------------------------------------------------------------- /sample/dracula.rs: -------------------------------------------------------------------------------- 1 | // Once upon a time... 2 | 3 | #[derive(Debug)] 4 | pub struct Vampire { 5 | location: String, 6 | birth_date: u16, 7 | death_date: u16, 8 | weaknesses: Vec, 9 | } 10 | 11 | impl Vampire { 12 | pub fn new( 13 | location: String, 14 | birth_date: u16, 15 | death_date: u16, 16 | weaknesses: Vec, 17 | ) -> Self { 18 | Vampire { 19 | location, 20 | birth_date, 21 | death_date, 22 | weaknesses, 23 | } 24 | } 25 | 26 | pub fn age(&self) -> u16 { 27 | self.calc_age() 28 | } 29 | 30 | fn calc_age(&self) -> u16 { 31 | self.death_date - self.birth_date 32 | } 33 | } 34 | 35 | // ...there was a guy named Vlad 36 | 37 | fn main() { 38 | let dracula = Vampire::new( 39 | "Transylvania".to_string(), 40 | 1428, 41 | 1476, 42 | vec!["Sunlight".to_string(), "Garlic".to_string()], 43 | ); 44 | 45 | println!("{:?}", dracula); 46 | } 47 | -------------------------------------------------------------------------------- /sample/dracula.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Once upon a time... 3 | */ 4 | class Vampire(location: String, birthDate: Int, deathDate: Int, weaknesses: Array[String]) { 5 | def age(): Int = { 6 | calcAge() 7 | } 8 | 9 | def calcAge(): Int = { 10 | this.deathDate - this.birthDate 11 | } 12 | } 13 | 14 | // ...there was a guy named Vlad 15 | val dracula = new Vampire(location = "Transylvania", birthDate = 1428, deathDate = 1476, weaknesses = Array("Sunlight", "Garlic")) 16 | -------------------------------------------------------------------------------- /sample/dracula.sml: -------------------------------------------------------------------------------- 1 | (* 2 | * Once upon a time... 3 | *) 4 | 5 | structure Vampire = struct 6 | type params = {location: string, 7 | birthDate: int, 8 | deathDate: int, 9 | weaknesses: string list} 10 | type vampire = params 11 | fun new (v : params) : vampire = v 12 | fun age (v : vampire) : int = (#deathDate v) - (#birthDate v) 13 | end 14 | 15 | (* ...there was a guy named Vlad *) 16 | 17 | structure Romainia = struct 18 | val dracula = Vampire.new {location="Transylvania", 19 | birthDate=1428, 20 | deathDate=1476, 21 | weaknesses=["Sunlight", "Garlic"]} 22 | end 23 | -------------------------------------------------------------------------------- /sample/dracula.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Once upon a time... 3 | */ 4 | 5 | class Vampire { 6 | var location: String 7 | var birthDate: Int 8 | var deathDate: Int 9 | var weaknesses: [String] 10 | 11 | init(location: String, birthDate: Int, deathDate: Int, weaknesses: [String]) { 12 | self.location = location 13 | self.birthDate = birthDate 14 | self.deathDate = deathDate 15 | self.weaknesses = weaknesses 16 | } 17 | 18 | var age: Int { 19 | self.calcAge() 20 | } 21 | 22 | func calcAge() -> Int { 23 | self.deathDate - self.birthDate 24 | } 25 | } 26 | 27 | // ...there was a guy named Vlad 28 | 29 | let dracula = Vampire(location: "Transylvania", birthDate: 1428, deathDate: 1476, weaknesses: ["Sunlight", "Garlic"]) -------------------------------------------------------------------------------- /sample/dracula.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Once upon a time... 3 | */ 4 | 5 | interface VampireProps { 6 | location: string; 7 | birthDate: number; 8 | deathDate: number; 9 | weaknesses: string[]; 10 | } 11 | 12 | class Vampire { 13 | location: string; 14 | birthDate: number; 15 | deathDate: number; 16 | weaknesses: string[]; 17 | 18 | constructor(props: VampireProps) { 19 | this.location = props.location; 20 | this.birthDate = props.birthDate; 21 | this.deathDate = props.deathDate; 22 | this.weaknesses = props.weaknesses; 23 | } 24 | 25 | get age(): number { 26 | return this.calcAge(); 27 | } 28 | 29 | calcAge(): number { 30 | return this.deathDate - this.birthDate; 31 | } 32 | } 33 | 34 | // ...there was a guy named Vlad 35 | 36 | const Dracula: VampireProps = new Vampire({ 37 | location: "Transylvania", 38 | birthDate: 1428, 39 | deathDate: 1476, 40 | weaknesses: ["Sunlight", "Garlic"], 41 | }); 42 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dracula/template/291aa546dbf6e95ba4eabec737df8d348125c379/screenshot.png --------------------------------------------------------------------------------