From ST I-II.88.2c: Whether Mortal and Venial Sin Differ in Genus.
[O]ne sin may be venial generically, and another generically mortal, according as the genus or species of an act is determined by its object. For, when the will is directed to a thing that is in itself contrary to charity, whereby man is directed to his last end, the sin is mortal by reason of its object. Consequently it is a mortal sin generically, whether it be contrary to the love of God, e.g. blasphemy, perjury, and the like, or against the love of one's neighbor, e.g. murder, adultery, and such like: wherefore such sins are mortal by reason of their genus. Sometimes, however, the sinner's will is directed to a thing containing a certain inordinateness, but which is not contrary to the love of God and one's neighbor, e.g. an idle word, excessive laughter, and so forth: and such sins are venial by reason of their genus.
Nevertheless, since moral acts derive their character of goodness and malice, not only from their objects, but also from some disposition of the agent, as stated above (I-II.18.4 & 6), it happens sometimes that a sin which is venial generically by reason of its object, becomes mortal on the part of the agent, either because he fixes his last end therein, or because he directs it to something that is a mortal sin in its own genus; for example, if a man direct an idle word to the commission of adultery.
[A]liquod peccatum dicatur veniale ex genere, et aliquod mortale ex genere, secundum quod genus vel species actus determinantur ex obiecto. Cum enim voluntas fertur in aliquid quod secundum se repugnat caritati, per quam homo ordinatur in ultimum finem, peccatum ex suo obiecto habet quod sit mortale. Unde est mortale ex genere, sive sit contra dilectionem Dei, sicut blasphemia, periurium, et huiusmodi; sive contra dilectionem proximi, sicut homicidium, adulterium, et similia. Unde huiusmodi sunt peccata mortalia ex suo genere. Quandoque vero voluntas peccantis fertur in id quod in se continet quandam inordinationem, non tamen contrariatur dilectioni Dei et proximi, sicut verbum otiosum, risus superfluus, et alia huiusmodi. Et talia sunt peccata venialia ex suo genere. Sed quia actus morales recipiunt rationem boni et mali non solum ex obiecto, sed etiam ex aliqua dispositione agentis, ut supra habitum est; contingit quandoque quod id quod est peccatum veniale ex genere ratione sui obiecti, fit mortale ex parte agentis, vel quia in eo constituit finem ultimum, vel quia ordinat ipsum ad aliquid quod est peccatum mortale ex genere, puta cum aliquis ordinat verbum otiosum ad adulterium committendum.