Coder Social home page Coder Social logo

Comments (4)

caglaryucekaya avatar caglaryucekaya commented on August 22, 2024

Can I take this one too 😄

from tvrank.

fredmorcos avatar fredmorcos commented on August 22, 2024

Yes of course 😃 I think it might make sense to split it into a couple of separate issues and have an overall milestone. However you'd like to do it though it's up to you.

from tvrank.

caglaryucekaya avatar caglaryucekaya commented on August 22, 2024

I need some more clarification on this one. Currently the only colored part is the Rating column, and the colors are added in this part:

let rating_cell = Cell::new(rating_text).with_style(match rating { rating if rating.rating() >= 70 => GREEN, rating if (60..70).contains(&rating.rating()) => YELLOW, _ => RED, });

Is the issue that TvRank should stop doing this if the NO_COLOR variable exists, or is there a way to disable coloring completely in a more general way?

from tvrank.

fredmorcos avatar fredmorcos commented on August 22, 2024

As a first step, I think you need to handle two things:

  1. Is the NO_COLOR environment variable set?
  2. Is the --color command-line argument passed? (You will need to add support for the --color argument)

The latter takes precedence. Examples:

  • If NO_COLOR is not set, and --color is not passed, then still show colors (the default).
  • If NO_COLOR is set but --color is passed, then still show colors.
  • If NO_COLOR is set and --color is not passed, then don't show colors.

The places where colors are displayed are the Rating column as you mentioned, and also the column titles that are displayed in bold (I guess this can also be considered coloring) under search::create_table():

  table.add_row(Row::new(vec![
    Cell::new("Primary Title").with_style(Attr::Bold),
    Cell::new("Original Title").with_style(Attr::Bold),
    Cell::new("Year").with_style(Attr::Bold),
    Cell::new("Rating").with_style(Attr::Bold),
    Cell::new("Votes").with_style(Attr::Bold),
    Cell::new("Runtime").with_style(Attr::Bold),
    Cell::new("Genres").with_style(Attr::Bold),
    Cell::new("Type").with_style(Attr::Bold),
    Cell::new("IMDB ID").with_style(Attr::Bold),
    Cell::new("IMDB Link").with_style(Attr::Bold),
  ]));

from tvrank.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.